HanDs
NO.2

[Visual Studio文章] 花指令产生器源码 





学习中请遵循国家相关法律法规,黑客不作恶。没有网络安全就没有国家安全

本站需要登陆后才能查看

C/ASM 花指令产生器源码

"\xe8\x11\x00\x00\x00\xe8\x29\x00\x00\x00\xe8\x07\x00\x00\x00\xb8\x00"\
"\x00\x00\x00\xff\xd0\xe8\x13\x00\x00\x00\x8d\x70\x18\xb4\x00\xb9\x00"\
"\x00\x00\x00\x8b\xfe\xac\x32\xc4\xaa\xe2\xfa\xc3\x58\x8b\xd8\x53\xc3"\
"\x90\x90\x90\x90\x90\xc3"

           =SOURCE=

.486
.model flat, STDCALL
option casemap:none
.data?
.data
.code
start:

call crypt

call CryptStart

call crypt

mov eax, 00000000h ; placeholder for OEP
call eax ; were done

crypt:
    call get_eip
    lea esi, [eax+18h] ; 0x18 bytes to stub

    mov ah, 00h ; KEY
    mov ecx, 00h ; YOUR_CODE_SIZE_IN_BYTES
    mov edi, esi

crypt_loop:
    lodsb
    xor al, ah
    stosb
    loop crypt_loop
ret
  

get_eip:
    pop eax
    mov ebx, eax
    push ebx
    ret
  
CryptStart: ; Our stub code goes here
    nop
    nop
    nop
    nop
    nop

    ret ; LEAVE INTACT
CryptEnd:

end start

---------------

#include <stdio.h>
#include <windows.h>

void Usage(char* Name)
{
     printf("\n\nUsage: %s <char> [size] <additional concatenated data>\n"
            "\n*note* additional data only availible via cli\n", Name);
      getch();
      exit(1);
     }

int main(int argc, char *argv[])
{
         HGLOBAL Text;
         HWND hwnd;
         char *Buff;
         char Input[16];
         int x, Size = 0;
         char newtitle[] = "Buffgen";
  
    if(argc > 1) {
            if(!strcmp(argv[1], "help") || !strcmp(argv[1], "?")) {
                       Usage(argv[0]); }
                      
            if(argc > 4) {
                    printf("Too many args. Try %s help.\n", argv[0]); }
          
            Buff = (char *)malloc(atoi(argv[2]) + sizeof(argv[3])); // alloc buff space
          
            for(x = 0; x < atoi(argv[2])+1; ++x) {
                  Buff[x] = (char)argv[1]; }
                
            if(argc == 4) {
                    strcat(Buff, argv[3]); }
            }
    else {
                
        printf("\t\t\t\t--Using interactive--\n\n"
               "Input: ");
      
        fgets(Input, 16, stdin);
      
       if(!strncmp(Input, "help", 4) || !strncmp(Input, "?", 1)) {
                       Usage(argv[0]);
                       return 1; }
  
        for(x = 0; x < sizeof(Input)-1; ++x) {
              if(isdigit(Input[x])) {
                                   Size = atoi(Input + x) + 1;
                                   break; }
        }
              if(Size == 0) {
                      Usage(argv[0]); }
        
          Buff = (char*)malloc(Size);

          memset(Buff, 0, Size+1);
        
          for(x = 0; x < Size; ++x) {
                      Buff[x] = Input[0]; }
                    
                      printf("\n\nClipboard contains:\n%s\n\n", Buff);            
      }
  
      if(!SetConsoleTitle(newtitle)) {
                                   printf("Error setting title.\n");
                                   getch();
                                   free(Buff);
                                   return 1; }  
  
        hwnd = FindWindow(NULL, newtitle);
  
      if(hwnd != NULL) {
      
            if(OpenClipboard(hwnd)) {
                                    EmptyClipboard();
                  
                    Text = GlobalAlloc(GMEM_MOVEABLE, strlen(Buff)+1);
                    if(Text == NULL) {
                            printf("GlobalAlloc error.\n");
                            getch();
                            free(Buff);
                            return 1; }
                  
                    VOID* pText = GlobalLock(Text);
                  
                    pText = strcpy((char*)pText, Buff);
                  
                    GlobalUnlock(Text);
                  
                    if(SetClipboardData(CF_TEXT, Text)) {
                                                  printf("[+]Set clipboard\n"); }
                    else {
                         printf("[-]Set clipboard\n"); }  
             CloseClipboard();
             }  
        }
    else {
         printf("FindWindow error.\n");
         getch();
         free(Buff);
         return 1; }
  
    free(Buff);    
   getch();
    return 0;
}


学习中请遵守法律法规,本网站内容均来自于互联网,本网站不负担法律责任
指令 产生 源码
#1楼
发帖时间:2016-7-9   |   查看数:0   |   回复数:0
游客组