Created
April 30, 2024 07:59
-
-
Save gabonator/f24a182436bf2f596b8bbd18b51426f3 to your computer and use it in GitHub Desktop.
sknicchall
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef unsigned char undefined; | |
typedef unsigned char byte; | |
typedef unsigned char dwfenc; | |
typedef unsigned int dword; | |
typedef long long longlong; | |
typedef unsigned int uint; | |
typedef unsigned long ulong; | |
typedef unsigned char undefined1; | |
typedef unsigned short undefined2; | |
typedef unsigned int undefined4; | |
typedef unsigned short ushort; | |
typedef unsigned short word; | |
typedef struct eh_frame_hdr eh_frame_hdr, *Peh_frame_hdr; | |
struct eh_frame_hdr { | |
byte eh_frame_hdr_version; // Exception Handler Frame Header Version | |
dwfenc eh_frame_pointer_encoding; // Exception Handler Frame Pointer Encoding | |
dwfenc eh_frame_desc_entry_count_encoding; // Encoding of # of Exception Handler FDEs | |
dwfenc eh_frame_table_encoding; // Exception Handler Table Encoding | |
}; | |
typedef struct fde_table_entry fde_table_entry, *Pfde_table_entry; | |
struct fde_table_entry { | |
dword initial_loc; // Initial Location | |
dword data_loc; // Data location | |
}; | |
typedef ushort sa_family_t; | |
typedef void _IO_lock_t; | |
typedef struct _IO_marker _IO_marker, *P_IO_marker; | |
typedef struct _IO_FILE _IO_FILE, *P_IO_FILE; | |
typedef long __off_t; | |
typedef longlong __quad_t; | |
typedef __quad_t __off64_t; | |
typedef ulong size_t; | |
struct _IO_FILE { | |
int _flags; | |
char * _IO_read_ptr; | |
char * _IO_read_end; | |
char * _IO_read_base; | |
char * _IO_write_base; | |
char * _IO_write_ptr; | |
char * _IO_write_end; | |
char * _IO_buf_base; | |
char * _IO_buf_end; | |
char * _IO_save_base; | |
char * _IO_backup_base; | |
char * _IO_save_end; | |
struct _IO_marker * _markers; | |
struct _IO_FILE * _chain; | |
int _fileno; | |
int _flags2; | |
__off_t _old_offset; | |
ushort _cur_column; | |
char _vtable_offset; | |
char _shortbuf[1]; | |
_IO_lock_t * _lock; | |
__off64_t _offset; | |
void * __pad1; | |
void * __pad2; | |
void * __pad3; | |
void * __pad4; | |
size_t __pad5; | |
int _mode; | |
char _unused2[40]; | |
}; | |
struct _IO_marker { | |
struct _IO_marker * _next; | |
struct _IO_FILE * _sbuf; | |
int _pos; | |
}; | |
typedef struct _IO_FILE FILE; | |
typedef struct sockaddr sockaddr, *Psockaddr; | |
struct sockaddr { | |
sa_family_t sa_family; | |
char sa_data[14]; | |
}; | |
typedef uint __socklen_t; | |
typedef __socklen_t socklen_t; | |
typedef int __ssize_t; | |
typedef __ssize_t ssize_t; | |
typedef struct evp_pkey_ctx_st evp_pkey_ctx_st, *Pevp_pkey_ctx_st; | |
struct evp_pkey_ctx_st { | |
}; | |
typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; | |
typedef struct Elf32_Dyn_x86 Elf32_Dyn_x86, *PElf32_Dyn_x86; | |
typedef enum Elf32_DynTag_x86 { | |
DT_NULL=0, | |
DT_NEEDED=1, | |
DT_PLTRELSZ=2, | |
DT_PLTGOT=3, | |
DT_HASH=4, | |
DT_STRTAB=5, | |
DT_SYMTAB=6, | |
DT_RELA=7, | |
DT_RELASZ=8, | |
DT_RELAENT=9, | |
DT_STRSZ=10, | |
DT_SYMENT=11, | |
DT_INIT=12, | |
DT_FINI=13, | |
DT_SONAME=14, | |
DT_RPATH=15, | |
DT_SYMBOLIC=16, | |
DT_REL=17, | |
DT_RELSZ=18, | |
DT_RELENT=19, | |
DT_PLTREL=20, | |
DT_DEBUG=21, | |
DT_TEXTREL=22, | |
DT_JMPREL=23, | |
DT_BIND_NOW=24, | |
DT_INIT_ARRAY=25, | |
DT_FINI_ARRAY=26, | |
DT_INIT_ARRAYSZ=27, | |
DT_FINI_ARRAYSZ=28, | |
DT_RUNPATH=29, | |
DT_FLAGS=30, | |
DT_PREINIT_ARRAY=32, | |
DT_PREINIT_ARRAYSZ=33, | |
DT_RELRSZ=35, | |
DT_RELR=36, | |
DT_RELRENT=37, | |
DT_ANDROID_REL=1610612751, | |
DT_ANDROID_RELSZ=1610612752, | |
DT_ANDROID_RELA=1610612753, | |
DT_ANDROID_RELASZ=1610612754, | |
DT_ANDROID_RELR=1879040000, | |
DT_ANDROID_RELRSZ=1879040001, | |
DT_ANDROID_RELRENT=1879040003, | |
DT_GNU_PRELINKED=1879047669, | |
DT_GNU_CONFLICTSZ=1879047670, | |
DT_GNU_LIBLISTSZ=1879047671, | |
DT_CHECKSUM=1879047672, | |
DT_PLTPADSZ=1879047673, | |
DT_MOVEENT=1879047674, | |
DT_MOVESZ=1879047675, | |
DT_FEATURE_1=1879047676, | |
DT_POSFLAG_1=1879047677, | |
DT_SYMINSZ=1879047678, | |
DT_SYMINENT=1879047679, | |
DT_GNU_XHASH=1879047924, | |
DT_GNU_HASH=1879047925, | |
DT_TLSDESC_PLT=1879047926, | |
DT_TLSDESC_GOT=1879047927, | |
DT_GNU_CONFLICT=1879047928, | |
DT_GNU_LIBLIST=1879047929, | |
DT_CONFIG=1879047930, | |
DT_DEPAUDIT=1879047931, | |
DT_AUDIT=1879047932, | |
DT_PLTPAD=1879047933, | |
DT_MOVETAB=1879047934, | |
DT_SYMINFO=1879047935, | |
DT_VERSYM=1879048176, | |
DT_RELACOUNT=1879048185, | |
DT_RELCOUNT=1879048186, | |
DT_FLAGS_1=1879048187, | |
DT_VERDEF=1879048188, | |
DT_VERDEFNUM=1879048189, | |
DT_VERNEED=1879048190, | |
DT_VERNEEDNUM=1879048191, | |
DT_AUXILIARY=2147483645, | |
DT_FILTER=2147483647 | |
} Elf32_DynTag_x86; | |
struct Elf32_Dyn_x86 { | |
enum Elf32_DynTag_x86 d_tag; | |
dword d_val; | |
}; | |
typedef struct Elf32_Sym Elf32_Sym, *PElf32_Sym; | |
struct Elf32_Sym { | |
dword st_name; | |
dword st_value; | |
dword st_size; | |
byte st_info; | |
byte st_other; | |
word st_shndx; | |
}; | |
typedef enum Elf_SectionHeaderType_x86 { | |
SHT_NULL=0, | |
SHT_PROGBITS=1, | |
SHT_SYMTAB=2, | |
SHT_STRTAB=3, | |
SHT_RELA=4, | |
SHT_HASH=5, | |
SHT_DYNAMIC=6, | |
SHT_NOTE=7, | |
SHT_NOBITS=8, | |
SHT_REL=9, | |
SHT_SHLIB=10, | |
SHT_DYNSYM=11, | |
SHT_INIT_ARRAY=14, | |
SHT_FINI_ARRAY=15, | |
SHT_PREINIT_ARRAY=16, | |
SHT_GROUP=17, | |
SHT_SYMTAB_SHNDX=18, | |
SHT_ANDROID_REL=1610612737, | |
SHT_ANDROID_RELA=1610612738, | |
SHT_GNU_ATTRIBUTES=1879048181, | |
SHT_GNU_HASH=1879048182, | |
SHT_GNU_LIBLIST=1879048183, | |
SHT_CHECKSUM=1879048184, | |
SHT_SUNW_move=1879048186, | |
SHT_SUNW_COMDAT=1879048187, | |
SHT_SUNW_syminfo=1879048188, | |
SHT_GNU_verdef=1879048189, | |
SHT_GNU_verneed=1879048190, | |
SHT_GNU_versym=1879048191 | |
} Elf_SectionHeaderType_x86; | |
typedef struct Elf32_Shdr Elf32_Shdr, *PElf32_Shdr; | |
struct Elf32_Shdr { | |
dword sh_name; | |
enum Elf_SectionHeaderType_x86 sh_type; | |
dword sh_flags; | |
dword sh_addr; | |
dword sh_offset; | |
dword sh_size; | |
dword sh_link; | |
dword sh_info; | |
dword sh_addralign; | |
dword sh_entsize; | |
}; | |
typedef struct Elf32_Rel Elf32_Rel, *PElf32_Rel; | |
struct Elf32_Rel { | |
dword r_offset; // location to apply the relocation action | |
dword r_info; // the symbol table index and the type of relocation | |
}; | |
typedef enum Elf_ProgramHeaderType_x86 { | |
PT_NULL=0, | |
PT_LOAD=1, | |
PT_DYNAMIC=2, | |
PT_INTERP=3, | |
PT_NOTE=4, | |
PT_SHLIB=5, | |
PT_PHDR=6, | |
PT_TLS=7, | |
PT_GNU_EH_FRAME=1685382480, | |
PT_GNU_STACK=1685382481, | |
PT_GNU_RELRO=1685382482 | |
} Elf_ProgramHeaderType_x86; | |
typedef struct Elf32_Phdr Elf32_Phdr, *PElf32_Phdr; | |
struct Elf32_Phdr { | |
enum Elf_ProgramHeaderType_x86 p_type; | |
dword p_offset; | |
dword p_vaddr; | |
dword p_paddr; | |
dword p_filesz; | |
dword p_memsz; | |
dword p_flags; | |
dword p_align; | |
}; | |
typedef struct Gnu_BuildId Gnu_BuildId, *PGnu_BuildId; | |
struct Gnu_BuildId { | |
dword namesz; // Length of name field | |
dword descsz; // Length of description field | |
dword type; // Vendor specific type | |
char name[4]; // Build-id vendor name | |
byte description[20]; // Build-id value | |
}; | |
typedef struct Elf32_Ehdr Elf32_Ehdr, *PElf32_Ehdr; | |
struct Elf32_Ehdr { | |
byte e_ident_magic_num; | |
char e_ident_magic_str[3]; | |
byte e_ident_class; | |
byte e_ident_data; | |
byte e_ident_version; | |
byte e_ident_osabi; | |
byte e_ident_abiversion; | |
byte e_ident_pad[7]; | |
word e_type; | |
word e_machine; | |
dword e_version; | |
dword e_entry; | |
dword e_phoff; | |
dword e_shoff; | |
dword e_flags; | |
word e_ehsize; | |
word e_phentsize; | |
word e_phnum; | |
word e_shentsize; | |
word e_shnum; | |
word e_shstrndx; | |
}; | |
typedef ushort uint16_t; | |
// WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx | |
int _init(EVP_PKEY_CTX *ctx) | |
{ | |
int iVar1; | |
iVar1 = __gmon_start__(); | |
return iVar1; | |
} | |
void FUN_08049020(void) | |
{ | |
// WARNING: Treating indirect jump as call | |
(*(code *)(undefined *)0x0)(); | |
return; | |
} | |
// WARNING: Unknown calling convention -- yet parameter storage is locked | |
int setsockopt(int __fd,int __level,int __optname,void *__optval,socklen_t __optlen) | |
{ | |
int iVar1; | |
iVar1 = setsockopt(__fd,__level,__optname,__optval,__optlen); | |
return iVar1; | |
} | |
void __libc_start_main(void) | |
{ | |
__libc_start_main(); | |
return; | |
} | |
// WARNING: Unknown calling convention -- yet parameter storage is locked | |
ssize_t read(int __fd,void *__buf,size_t __nbytes) | |
{ | |
ssize_t sVar1; | |
sVar1 = read(__fd,__buf,__nbytes); | |
return sVar1; | |
} | |
// WARNING: Unknown calling convention -- yet parameter storage is locked | |
int fflush(FILE *__stream) | |
{ | |
int iVar1; | |
iVar1 = fflush(__stream); | |
return iVar1; | |
} | |
// WARNING: Unknown calling convention -- yet parameter storage is locked | |
uint16_t htons(uint16_t __hostshort) | |
{ | |
uint16_t uVar1; | |
uVar1 = htons(__hostshort); | |
return uVar1; | |
} | |
// WARNING: Unknown calling convention -- yet parameter storage is locked | |
void perror(char *__s) | |
{ | |
perror(__s); | |
return; | |
} | |
// WARNING: Unknown calling convention -- yet parameter storage is locked | |
int accept(int __fd,sockaddr *__addr,socklen_t *__addr_len) | |
{ | |
int iVar1; | |
iVar1 = accept(__fd,__addr,__addr_len); | |
return iVar1; | |
} | |
// WARNING: Unknown calling convention -- yet parameter storage is locked | |
int puts(char *__s) | |
{ | |
int iVar1; | |
iVar1 = puts(__s); | |
return iVar1; | |
} | |
// WARNING: Unknown calling convention -- yet parameter storage is locked | |
void exit(int __status) | |
{ | |
// WARNING: Subroutine does not return | |
exit(__status); | |
} | |
// WARNING: Unknown calling convention -- yet parameter storage is locked | |
FILE * fdopen(int __fd,char *__modes) | |
{ | |
FILE *pFVar1; | |
pFVar1 = fdopen(__fd,__modes); | |
return pFVar1; | |
} | |
// WARNING: Unknown calling convention -- yet parameter storage is locked | |
int fprintf(FILE *__stream,char *__format,...) | |
{ | |
int iVar1; | |
iVar1 = fprintf(__stream,__format); | |
return iVar1; | |
} | |
// WARNING: Unknown calling convention -- yet parameter storage is locked | |
ssize_t write(int __fd,void *__buf,size_t __n) | |
{ | |
ssize_t sVar1; | |
sVar1 = write(__fd,__buf,__n); | |
return sVar1; | |
} | |
// WARNING: Unknown calling convention -- yet parameter storage is locked | |
int bind(int __fd,sockaddr *__addr,socklen_t __len) | |
{ | |
int iVar1; | |
iVar1 = bind(__fd,__addr,__len); | |
return iVar1; | |
} | |
// WARNING: Unknown calling convention -- yet parameter storage is locked | |
int listen(int __fd,int __n) | |
{ | |
int iVar1; | |
iVar1 = listen(__fd,__n); | |
return iVar1; | |
} | |
// WARNING: Unknown calling convention -- yet parameter storage is locked | |
int socket(int __domain,int __type,int __protocol) | |
{ | |
int iVar1; | |
iVar1 = socket(__domain,__type,__protocol); | |
return iVar1; | |
} | |
// WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx | |
void _start(void) | |
{ | |
__libc_start_main(&__wrap_main); | |
do { | |
// WARNING: Do nothing block with infinite loop | |
} while( true ); | |
} | |
// WARNING: This is an inlined function | |
void __i686_get_pc_thunk_bx(void) | |
{ | |
return; | |
} | |
void _dl_relocate_static_pie(void) | |
{ | |
return; | |
} | |
// WARNING: This is an inlined function | |
void __x86_get_pc_thunk_bx(void) | |
{ | |
return; | |
} | |
// WARNING: Removing unreachable block (ram,0x0804918c) | |
// WARNING: Removing unreachable block (ram,0x08049195) | |
void deregister_tm_clones(void) | |
{ | |
return; | |
} | |
// WARNING: Removing unreachable block (ram,0x080491d8) | |
// WARNING: Removing unreachable block (ram,0x080491e1) | |
void register_tm_clones(void) | |
{ | |
return; | |
} | |
void __do_global_dtors_aux(void) | |
{ | |
if (completed_0 == '\0') { | |
deregister_tm_clones(); | |
completed_0 = 1; | |
return; | |
} | |
return; | |
} | |
void frame_dummy(void) | |
{ | |
register_tm_clones(); | |
return; | |
} | |
void check_new_mails(char *param_1,int param_2) | |
{ | |
FILE *__stream; | |
puts("reading"); | |
__stream = fdopen(param_2,"w"); | |
if (__stream == (FILE *)0x0) { | |
perror("Failed to open socket as stream"); | |
} | |
else { | |
fprintf(__stream,param_1); | |
fflush(__stream); | |
write(param_2,"has 0 new mails\n",0x10); | |
} | |
return; | |
} | |
void read_mail(int param_1) | |
{ | |
undefined local_4c [72]; | |
write(param_1,"Enter your mail: ",0x11); | |
read(param_1,local_4c,0x40); | |
check_new_mails(local_4c,param_1); | |
return; | |
} | |
void send_mail(int param_1) | |
{ | |
undefined local_18c [256]; | |
undefined local_8c [64]; | |
undefined local_4c [72]; | |
write(param_1,"Recipient mail: ",0x10); | |
read(param_1,local_8c,0x40); | |
write(param_1,"Your mail: ",0xb); | |
read(param_1,local_4c,0x100); | |
write(param_1,"Message: ",9); | |
read(param_1,local_18c,1000); | |
write(param_1,"Mail sent\n",10); | |
return; | |
} | |
int setup_socket(void) | |
{ | |
int iVar1; | |
undefined4 local_28; | |
sockaddr local_24; | |
int local_14; | |
undefined4 local_10; | |
local_28 = 1; | |
local_10 = 0x10; | |
local_14 = socket(2,1,0); | |
if (local_14 == 0) { | |
perror("socket failed"); | |
// WARNING: Subroutine does not return | |
exit(1); | |
} | |
iVar1 = setsockopt(local_14,1,0xf,&local_28,4); | |
if (iVar1 != 0) { | |
perror("setsockopt"); | |
// WARNING: Subroutine does not return | |
exit(1); | |
} | |
local_24.sa_family = 2; | |
local_24.sa_data._2_4_ = 0; | |
local_24.sa_data._0_2_ = htons(0x8ae); | |
iVar1 = bind(local_14,&local_24,0x10); | |
if (iVar1 < 0) { | |
perror("bind failed"); | |
// WARNING: Subroutine does not return | |
exit(1); | |
} | |
iVar1 = listen(local_14,3); | |
if (iVar1 < 0) { | |
perror("listen"); | |
// WARNING: Subroutine does not return | |
exit(1); | |
} | |
return local_14; | |
} | |
undefined4 main(void) | |
{ | |
char local_1a [2]; | |
int local_18; | |
int local_14; | |
undefined *local_c; | |
local_c = &stack0x00000004; | |
local_14 = setup_socket(); | |
puts("Listening on port 2222..."); | |
fflush(stdout); | |
local_18 = accept(local_14,(sockaddr *)0x0,(socklen_t *)0x0); | |
if (local_18 < 0) { | |
perror("accept"); | |
// WARNING: Subroutine does not return | |
exit(1); | |
} | |
write(local_18,"###########################\n",0x1c); | |
write(local_18,"# Mail messenger #\n",0x1c); | |
write(local_18,"###########################\n",0x1c); | |
write(local_18,"Commands:\n",10); | |
write(local_18,"1) Read mails\n",0xf); | |
write(local_18,"2) Send new mail\n",0x12); | |
while( true ) { | |
while( true ) { | |
write(local_18,&DAT_0804a13c,1); | |
read(local_18,local_1a,2); | |
if (local_1a[0] != '1') break; | |
read_mail(local_18); | |
} | |
if (local_1a[0] != '2') break; | |
send_mail(local_18); | |
} | |
write(local_18,"wrong command\n",0xe); | |
return 1; | |
} | |
// WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx | |
void _fini(void) | |
{ | |
return; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment