getaddr.c

Kail-KM
|2015. 5. 6. 21:28



'Programming > C' 카테고리의 다른 글

C 언어 정리  (0) 2015.08.16
VisualSstudio 2013 Error : Class not registered. Looking for object with CLSID: {3B6A8A95-60A9-4EFC-AB17-DD892979B105}  (0) 2015.07.17
EggShell.c  (0) 2015.05.06
MsgBox.dll  (1) 2015.03.22
Make Simple AutoRun  (0) 2015.02.26

EggShell.c

Kail-KM
|2015. 5. 6. 10:29



'Programming > C' 카테고리의 다른 글

VisualSstudio 2013 Error : Class not registered. Looking for object with CLSID: {3B6A8A95-60A9-4EFC-AB17-DD892979B105}  (0) 2015.07.17
getaddr.c  (0) 2015.05.06
MsgBox.dll  (1) 2015.03.22
Make Simple AutoRun  (0) 2015.02.26
Make Simple Bat File  (0) 2015.02.26

'Programming > Python' 카테고리의 다른 글

Socket_server.py  (0) 2015.05.28
Socket_client.py  (0) 2015.05.28
DLL Injection API by Python  (0) 2015.03.25
if f=open('test.txt','r') == True: ||if not f=open('test.txt','r'): 은 안된다.  (0) 2015.03.05
Key_logger.py in GitHub  (0) 2015.03.05

DLL Injection API



Python Source Code




프로세스의 핸들을 구하기


hProc = kernel32.OpenProcess(<1>DesireAddress,<2>InheritHandle,<3>ProcessId)

<1> 권한 설정 : PROCESS_ALL_ACCESS = 0x1F0FFF

<2> 상속 여부 : True = 상속, False = 비상속으로 비상속을 선택.

<3> PID : Process ID



해당 프로세스에 가상의 메모리를 할당


Virtual_addr = kernel32.VirtualAllocEx(<1>hProcess,<2>Address,

<3>Size,<4>AllocationType,<5>Protect

<1> Process Handle : -> hProc

<2> 위치 지정 : NULL의 경우 따로 원하는 주소를 설정하지 않음 (None)

<3> 할당할 위치의 크기로 len(dll_file)

<4> 할당 유형 : Commit(0x1000) or Commit&Reserve(0x3000)

<5> 보호(권한) : ReadWrite = 0x04

 



해당 메모리의 위치에 DLL 파일을 기록


kernel32.WriteProcessMemory(<1>hProcess,<2>BaseAddress,<3>Buffer,<4>Size,<5>NumberOfByteWritten)

<1> hProc

<2> Virtual_addr : 지정 프로세스에 데이터가 기록될 주소

<3> 기록될 내용 : dll_file

<4> 크기 : len(dlll_file)

<5> 지정된 프로세스로 전송 된 바이트의 수를받는 변수의 포인터로 NULL > Ignored (NULL)




LoadLibraryA 함수의 위치를 구한다(상대프로세서가 아니라 자신에게서 구함,위치가 같기에)


hmod = kernel32.GetModuleHandleA(<1>ModuleName)

<1> kernel32

load_addr = kernel32.GetProcAddress(<1>hModule,<2>ProcName)

<1> hmod

<2> ‘LoadLibraryA’

 


원격 스레드를 생성


Kernel32.CreateRemoteThread(<1>hProc,<2>ThreadAttributes,<3>StackSize,<4>StartAddress,<5>Parameter,<6>CreationFlags,<7>ThreadId)

<1> hProc

<2> Security Attributes : NULL의 경우 Default로 설정이 된다.

<3> 0으로 설정 할경우 Default로 설정

<4> 스레드에 의해 실행될 함수의 주소 load_addr

<5> 변수에 전달될 스레드함수 > virtual_addr

<6> 스레드 생성 제어 플러그로 ‘0’의 경우 스레드 생성된 즉시 실행

<7> NULL의 경우 리턴값이 없다. ( NULL )


DLL_Injector.exe






'Programming > Python' 카테고리의 다른 글

Socket_client.py  (0) 2015.05.28
Code Injection by Python  (1) 2015.03.26
if f=open('test.txt','r') == True: ||if not f=open('test.txt','r'): 은 안된다.  (0) 2015.03.05
Key_logger.py in GitHub  (0) 2015.03.05
Del_file.py in GitHub  (0) 2015.03.02

MsgBox.dll

Kail-KM
|2015. 3. 22. 22:24

'Programming > C' 카테고리의 다른 글

getaddr.c  (0) 2015.05.06
EggShell.c  (0) 2015.05.06
Make Simple AutoRun  (0) 2015.02.26
Make Simple Bat File  (0) 2015.02.26
C언어 요약정리  (0) 2015.01.10

if f=open('test.txt','r') == True:  이나

if not f=open('test.txt','r'):     은 동작 할 수가 없다.



따라서 어떠한 파일을 읽기모드로 열고자 할떄 그 파일의 존재 여부를 가지고 할 수있는 문장은 아래와 같다.

try:

f=open('test.txt','r')

print f.read()

except IOError:

print "Don't Exist File..."

'Programming > Python' 카테고리의 다른 글

Code Injection by Python  (1) 2015.03.26
DLL Injection API by Python  (0) 2015.03.25
Key_logger.py in GitHub  (0) 2015.03.05
Del_file.py in GitHub  (0) 2015.03.02
Setup.py // Py2Exe 사용법  (0) 2015.02.26





'Programming > Python' 카테고리의 다른 글

if f=open('test.txt','r') == True: ||if not f=open('test.txt','r'): 은 안된다.  (0) 2015.03.05
Key_logger.py in GitHub  (0) 2015.03.05
Setup.py // Py2Exe 사용법  (0) 2015.02.26
Steal_Path.py in GitHub  (0) 2015.02.26
Memo.py in GitHub  (0) 2015.02.26