-
Posts
134 -
Joined
-
Last visited
-
Days Won
1
Everything posted by JIHAD
-
[C++] [AJUTOR] Network connection: Ping, check online si request timeout ?
JIHAD replied to Che's topic in Programare
msdn, google, etc. e plin internetul. ti-am zis mai sus ce si cum, daca nu intelegi, inseamna ca trebuie sa mai citesti. -
[C++] [AJUTOR] Network connection: Ping, check online si request timeout ?
JIHAD replied to Che's topic in Programare
te sfatuiesc sa citesti mai multe despre sockets. -
[C++] [AJUTOR] Network connection: Ping, check online si request timeout ?
JIHAD replied to Che's topic in Programare
ai setsockopt pentru timeout. in exemplul pe care ti l-am dat zilele trecute se vede clar ca am folosit setsockopt. sau, poti folosi non-blocking socket cu functia select. ioctlsocket(socket, FIONBIO, 1); ptr non-blocking socket select: select function (Windows) si: unsigned long addr; addr = inet_addr(szServerName); server.sin_addr.s_addr = addr; e prost rau codul, nu stiu de unde l-ai luat -
ce ai incercat si unde ai ajuns?
-
#include <sys/socket.h> #include <netinet/in.h> #include <sys/select.h> #include <unistd.h> #include <arpa/inet.h> #include <sys/time.h> #include <sys/types.h> #include <stdlib.h> #include <fcntl.h> #include <string.h> #include <stdio.h> #include <netdb.h> #define USERAGENT "JIHAD HTTP AGENT" int socket_connect (char *hostme, int port) { struct timeval tv; tv.tv_sec = 3; tv.tv_usec = 0; int error, handle; struct hostent *host; struct sockaddr_in server; host = gethostbyname (hostme); if (host != NULL){ handle = socket (AF_INET, SOCK_STREAM, 6); if (handle == -1) { return handle; } else { server.sin_family = AF_INET; server.sin_port = htons (port); server.sin_addr = *((struct in_addr *) host->h_addr); if (server.sin_addr.s_addr != -1 ){ bzero (&(server.sin_zero), 8); setsockopt (handle, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)); setsockopt (handle, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(tv)); error = connect (handle, (struct sockaddr *) &server, sizeof (struct sockaddr)); if (error == -1) return handle; } } } else printf("Invalid IP address.\n"); return handle; } int checkpage(char *hostname, char *page) { int socket_desc; char buf[2000000]; char server_reply[2]; char message[2000]; socket_desc = socket_connect(hostname,80); sprintf(message,"GET %s HTTP/1.1\r\nHost: %s\r\nUser-Agent: %s\r\nConnection: close\r\n\r\n", page, hostname, USERAGENT); if( send(socket_desc , message , strlen(message), 0) < 0) { return 1; } while(recv(socket_desc, server_reply , 1 , 0) > 0){ sprintf(buf,"%s%s",buf, server_reply); } printf(buf); } int main(int argc, char **argv) { checkpage(argv[1],argv[2]); } rulezi ./http yahoo.com / Output: root@superstars:~/new-proj# ./http yahoo.com / HTTP/1.1 301 Redirect Date: Fri, 26 Dec 2014 14:18:44 GMT Via: http/1.1 ir7.fp.ne1.yahoo.com (ApacheTrafficServer) Server: ATS Location: https://www.yahoo.com// Content-Type: text/html Content-Language: en Cache-Control: no-store, no-cache Connection: keep-alive Content-Length: 1450 <!DOCTYPE html> <html lang="en-us"><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta charset="utf-8"> <title>Yahoo</title> <meta name="viewport" content="width=device-width,initial-scale=1,minimal-ui"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <style> html { height: 100; } body { background: #fafafc url(https://s.yimg.com/nn/img/sad-panda-201402200631.png) 50 50; background-size: cover; height: 100; text-align: center; font: 300 18px "helvetica neue", helvetica, verdana, tahoma, arial, sans-serif; } table { height: 100; width: 100; table-layout: fixed; border-collapse: collapse; border-spacing: 0; border: none; } h1 { font-size: 42px; font-weight: 400; color: #400090; } p { color: #1A1A1A; } #message-1 { font-weight: bold; margin: 0; } #message-2 { display: inline-block; *display: inline; zoom: 1; max-width: 17em; _width: 17em; } </style> </head> <body> <!-- status code : 301 --> <!-- Error: GET --> <table> <tbody><tr> <td> <img src="https://s.yimg.com/nn/img/yahoo-logo-201402200629.png" alt="Yahoo Logo"> <h1 style="margin-top:20px;">Will be right back...</h1> <p id="message-1">Thank you for your patience.</p> <p id="message-2">Our engineers are working quickly to resolve the issue.</p> </td> </tr> </tbody></table> </body></html> nu o sa-ti mearga SSL, ptr. ssl trebuie sa implementezi Openssl codul e ptr. unix, il portezi usor ptr. winsock. doar la socket nu stau sa ti-l explic, il vezi si incerci sa-l intelegi.
-
sau asa #include <iostream> #include <cstring> using namespace std; int main(){ int i = 0, prag = 0; char vocale[]={"aeiouAEIOU"}; char temp[100], *ginel; ginel = new char(); cout << "Introdu textul: " << endl; cin >> ginel; while (ginel[i]!= '\0'){ if(!strchr(vocale,ginel[i])) { temp[prag++] = ginel[i]; } else { temp[prag] = ginel[i]; } i++; } temp[prag+1] = '\0'; cout << temp << "\n"; } Output: root@superstars:~# ./vow Introdu textul: manca-ti-as mnc-t-s
-
sau asa #include <iostream> #include <string.h> using namespace std; int main() { char *ginel; ginel = new char(); char vocale[]={"aeiouAEIOU"}; cout << "Introdu textul: " << endl; cin >> ginel; for (int i=0;ginel[i]!='\0';i++) { if(strchr(vocale,ginel[i])) { ginel[i]=' '; } } cout << ginel; return 0; }
-
#include <iostream> using namespace std; int main() { char *ginel; ginel = new char(); cout << "Introdu textul: " << endl; cin >> ginel; for (int i=0;ginel[i]!='\0';i++) { if (ginel[i]=='a' || ginel[i]=='e' || ginel[i]=='i' || ginel[i]=='o' || ginel[i]=='u' || ginel[i]=='A' || ginel[i]=='E' || ginel[i]=='I' || ginel[i]=='O' || ginel[i]=='U') { ginel[i]=' '; } } cout << ginel; return 0; }
-
Salut, nu stiu daca asta este locul potrivit sa te dezvolti, dar bine ai venit.
-
bun, sa zicem prin absurd ca asta e o idee pertinenta. Spui ca nu stii sa faci asta. Deci cum "ne" apucam de treaba? propun sa fie mutat topicul...
-
trebuia sa editezi profilul fetei. nu e bine sa transferi informatii din mediul privat in cel public.
-
asta cu gecko mi-a placut cel mai mult. Daca mai aveai si mesajul...
-
I'm using English so i can make sure everyone gets the point. As you read in the title, I'm seeking for a passionate colleague that will take care of website-development and graphics for a new opensource project. I will continue with a small Q&A. (i hope these are your main questions. ) Q: What is the project about? A: Well, is about pentesting. I'm implementing a bunch of protocols and pentesting techniques written from scratch. Q: Why? There is also ncrack, hydra, metasploit, etc. A: I'm aware of all of them. But sometimes using them is difficult for some unexperienced users. There are also new modules that they do not exists in other pentesting frameworks and apps, at least not by default. Q: What protocols and tehniques? A: At this moment this is the project status: Completed Items: - (BRUTE) SMTP - Non-Encrypted and SSL/TLS with AUTH PLAIN and LOGIN available (ports 25,587,465). Protocol detections are made by itself, no need to specify anything but the port. - (BRUTE) FTP - Non-Encrypted and SSL/TLS. - (BRUTE) VNC - with AUTH and No-AUTH. - (BRUTE) SSH. - (BRUTE) HTTP/HTTPS BASIC Authentication. In Progress: - (BRUTE) IMAP Non-Encrypted and SSL/TLS (Almost there...). - (BRUTE) POP3 Non-Encrypted and SSL/TLS (Almost there...). - XSS Detection both HTTP/HTTPS. - SQL Injection Detection. - (BRUTE) HTTP/HTTPS form(Will identify login forms and submit). - (BRUTE) RDP AUTH (Almost there...). - (many more to come ) TODO: - At this moment SSH implementation is based on libssh2 library. Need to write the proto negociation and authentication to reduce library dependencies. (HINTS?). Above list is subject of change. Expect more to come. As you can see, there are many things going on. It's a big project that is time consuming. If you have time and wish to participate or willing to find out more about it, send me a message. I prefer to keep this thread clean. Thanks!
-
fix it! lazy idiot!
-
excange = exchange. in panel-ul de login iti ies obiectele p-afara. Aliniaza si in recover.php. Nu folosi extensia php la link-uri. e foarte gol site-ul, e greu sa imi dau seama.
-
Folositor pentru facut brute de cpanel. //JIHAD 2014 //usage: ./http user:password ip port #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <string.h> #include <stdio.h> #define USERAGENT "JIHAD HTTP AGENT" #define TABLELEN 63 #define BUFFFERLEN 128 #define ENCODERLEN 4 #define ENCODEROPLEN 0 #define ENCODERBLOCKLEN 3 #define PADDINGCHAR '=' #define BASE64CHARSET "ABCDEFGHIJKLMNOPQRSTUVWXYZ"\ "abcdefghijklmnopqrstuvwxyz"\ "0123456789"\ "+/"; int Base64Encode(char *input, char *output, int oplen); int encodeblock(char *input, char *output, int oplen); int Base64Decode(char *input, char *output, int oplen); int decodeblock(char *input, char *output, int oplen); int encodeblock(char *input, char *output, int oplen){ int rc = 0, iplen = 0; char encodedstr[ENCODERLEN + 1] = ""; char encodingtabe[TABLELEN + 1] = BASE64CHARSET; iplen = strlen(input); encodedstr[0] = encodingtabe[ input[0] >> 2 ]; encodedstr[1] = encodingtabe[ ((input[0] & 0x03) << 4) | ((input[1] & 0xf0) >> 4) ]; encodedstr[2] = (iplen > 1 ? encodingtabe[ ((input[1] & 0x0f) << 2) | ((input[2] & 0xc0) >> 6) ] : PADDINGCHAR); encodedstr[3] = (iplen > 2 ? encodingtabe[ input[2] & 0x3f ] : PADDINGCHAR); strncat(output, encodedstr, oplen-strlen(output)); return rc; } int Base64Encode(char *input, char *output, int oplen){ int rc = 0; int index = 0, ipindex = 0, iplen = 0; char encoderinput[ENCODERBLOCKLEN + 1] = ""; iplen = strlen(input); while(ipindex < iplen){ for(index = 0; index < 3; index++){ if(ipindex < iplen){ encoderinput[index] = input[ipindex]; }else{ encoderinput[index] = 0; } ipindex++; } rc = encodeblock(encoderinput, output, oplen); } return rc; } int http_auth(char *username,char *hostname, char *port) { int rc = 0; char auth[BUFFFERLEN + 1] = ""; int sock; struct sockaddr_in server; char server_reply[2000]; char message[2000]; sock = socket(AF_INET , SOCK_STREAM , 0); if (sock == -1) { return -1; } server.sin_addr.s_addr = inet_addr(hostname); server.sin_family = AF_INET; server.sin_port = htons( atoi(port) ); if (connect(sock , (struct sockaddr *)&server , sizeof(server)) < 0) { return -1; } rc = Base64Encode(username, auth, BUFFFERLEN); sprintf(message,"GET / HTTP/1.1\r\nHost: %s\r\nUser-Agent: %s\r\nAuthorization: Basic %s\r\nConnection: close\r\n\r\n", hostname, USERAGENT, auth); send(sock, message , strlen(message), 0); recv(sock, server_reply , 2000 , 0); printf(server_reply); return 0; } int main(int argc, char **argv) { http_auth(argv[1],argv[2], argv[3]); }
-
In C trebuie. Ala e C# cred. Nu?
-
sau asa: n-am folosit for in for. strlen este in afara while... int main(){ int i = 0, prag = 0; char *replace = "spatiu"; const char *str1 = "mama are mere"; int replacelen = strlen(replace); char buff[10000]; while (str1[i]!= '\0'){ if (str1[i] != 32) { buff[prag++] = str1[i]; } else { sprintf(buff, "%s%s",buff, replace); prag = prag + replacelen; } i++; } buff[prag+1] = '\0'; printf("%s\n",buff); }
-
int main(){ int i = 0, prag = 0; char buff[10000]; const char *str1 = "mama are mere"; while (str1[i]!= '\0'){ if (str1[i] != 32) { buff[prag++] = str1[i]; } else { buff[prag] = 115; buff[prag+1] = 112; buff[prag+2] = 97; buff[prag+3] = 116; buff[prag+4] = 105; buff[prag+5] = 117; prag = prag + 6; } i++; } buff[prag+1] = '\0'; printf("%s\n",buff); } Output: root@superstars:~/Downloads# ./rep mamaspatiuarespatiumere nu e f. bun codul, dar indeplineste cerintele tale
-
uite si recursiv. iti cauta doar intr-o directie. cauta fisiere din argv[1] (recursiv, toate subfolderele) in path2(recursiv, toate subfolderele) . le afiseaza si le si numara pe cele negasite. Sa-ti mearga in ambele directii vezi exemplul dinainte. cu placere. #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <dirent.h> #include <sys/param.h> #include <stdbool.h> #define path2 "/etc" bool *dir2compare( char *path, char *findme ){ DIR *dir; struct dirent *entry; char spath[MAXPATHLEN] = "", spath2[MAXPATHLEN] = ""; if( !(dir = opendir( path))){ perror("opendir"); exit(1);} for( entry = readdir( dir); entry; entry = readdir( dir)){ sprintf( spath, "%s/%s", path, entry->d_name); if( entry->d_type == DT_REG){ if(strcmp(entry->d_name,findme)==0) return true; } if( entry->d_type == DT_DIR && (strcmp( ".", entry->d_name)) && (strcmp( "..", entry->d_name))){ dir2compare(spath,findme); } } closedir( dir); } char *dirfind( char *path, int *fgasit){ DIR *dir; char *temp; struct dirent *entry; char spath[MAXPATHLEN] = "", spath2[MAXPATHLEN] = ""; if( !(dir = opendir( path))){ perror("opendir"); exit(1);} for( entry = readdir( dir); entry; entry = readdir( dir)){ sprintf( spath, "%s/%s", path, entry->d_name); if( entry->d_type == DT_REG){ if(!dir2compare(path2, entry->d_name)) { printf("[*] %s\n", spath); (*fgasit)++; } } if( entry->d_type == DT_DIR && (strcmp( ".", entry->d_name)) && (strcmp( "..", entry->d_name))){ dirfind(spath, fgasit); } } closedir( dir); return(0); } int main(int argc, char *argv[]){ int i = 0; if (argc == 2){ dirfind(argv[1],&i); printf(" %d fisiere nu corespund.\n", i); } }
-
te joci tu cu el mai departe. ideea e tot asta uite o solutie sa-ti arate cum ai zis tu. int parsedir(char *directory1, char *directory2){ char *temp, *temp1; DIR *dir1, *dir2; struct dirent *epdf; struct dirent *epdf2; dir1 = opendir(directory1); dir2 = opendir(directory2); if ((dir1 != NULL) && (dir2 != NULL)){ while (epdf = readdir(dir1)){ temp = strdup(epdf->d_name); while (epdf2 = readdir(dir2)){ temp1 = strdup(epdf2->d_name); if(strcmp(temp,temp1)!=0) printf("%s/%s\n",directory2,temp1); } } closedir(dir1); closedir(dir2); } free(temp); free(temp1); printf("Done.\n"); return 0; } int main(int argc, char *argv[]){ if (argc == 3) { parsedir(argv[1],argv[2]); parsedir(argv[2],argv[1]); } else exit(printf("Argument missing\n")); return 0; }
-
prettyprinter.de Util mai ales daca scrii cod in consola.
-
Cred ca ceva de genul asta vrei. Iti listeaza fisierele din directory2 care nu exista in directory1. #include <dirent.h> int main(int argc, char *argv[]){ char *temp, *temp1, *directory1, *directory2; DIR *dir1, *dir2; struct dirent *epdf; struct dirent *epdf2; if (argc == 3) { directory1 = argv[1]; directory2 = argv[2]; dir1 = opendir(directory1); dir2 = opendir(directory2); if ((dir1 != NULL) && (dir2 != NULL)){ while (epdf = readdir(dir1)){ temp = strdup(epdf->d_name); while (epdf2 = readdir(dir2)){ temp1 = strdup(epdf2->d_name); if(strcmp(temp,temp1)!=0) printf("%s/%s\n",directory2,temp1); } } closedir(dir1); closedir(dir2); } } else exit(printf("Argument missing\n")); printf("Done.\n"); } Sunt mai multe moduri in care poti face asta, eu am ales calea cea mai la indemana. am updatat sa-ti accepte si argumente. iti sugerez sa reverifici codul ca l-am scris in graba...
-
It's C, it has to be compiled.