mirror of
https://github.com/rofl0r/proxychains-ng.git
synced 2025-09-07 10:47:02 +00:00
move stringfromipv4 into common.c
This commit is contained in:
24
src/common.c
24
src/common.c
@ -3,6 +3,30 @@
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// stolen from libulz (C) rofl0r
|
||||
void pc_stringfromipv4(unsigned char *ip_buf_4_bytes, char *outbuf_16_bytes) {
|
||||
unsigned char *p;
|
||||
char *o = outbuf_16_bytes;
|
||||
unsigned char n;
|
||||
for(p = ip_buf_4_bytes; p < ip_buf_4_bytes + 4; p++) {
|
||||
n = *p;
|
||||
if(*p >= 100) {
|
||||
if(*p >= 200)
|
||||
*(o++) = '2';
|
||||
else
|
||||
*(o++) = '1';
|
||||
n %= 100;
|
||||
}
|
||||
if(*p >= 10) {
|
||||
*(o++) = (n / 10) + '0';
|
||||
n %= 10;
|
||||
}
|
||||
*(o++) = n + '0';
|
||||
*(o++) = '.';
|
||||
}
|
||||
o[-1] = 0;
|
||||
}
|
||||
|
||||
static int check_path(char *path) {
|
||||
if(!path)
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user