1
0
This commit is contained in:
Daniel Tartavel 2020-05-08 13:10:56 +02:00
parent 8064268f6c
commit 0349a10ba7

12
main.c
View File

@ -42,16 +42,16 @@ void getutmp( int pid, char user[], char host_ip[], char host_ipv6[], time_t * t
if((utmp->ut_addr_v6[1] && utmp->ut_addr_v6[2] && utmp->ut_addr_v6[3]) == 0) if((utmp->ut_addr_v6[1] && utmp->ut_addr_v6[2] && utmp->ut_addr_v6[3]) == 0)
{ {
ipv4 = utmp->ut_addr_v6[0] & 0x00000000000000ff; ipv4 = utmp->ut_addr_v6[0] & 0x00000000000000ff;
sprintf( str, "%x.", ipv4); sprintf( str, "%d.", ipv4);
strcat(host_ip, str); strcat(host_ip, str);
ipv4 = (utmp->ut_addr_v6[0] & 0x000000000000ff00) >> 8; ipv4 = (utmp->ut_addr_v6[0] & 0x000000000000ff00) >> 8;
sprintf( str, "%x.", ipv4); sprintf( str, "%d.", ipv4);
strcat(host_ip, str); strcat(host_ip, str);
ipv4 = (utmp->ut_addr_v6[0] & 0x0000000000ff0000) >> 16; ipv4 = (utmp->ut_addr_v6[0] & 0x0000000000ff0000) >> 16;
sprintf( str, "%x.", ipv4); sprintf( str, "%d.", ipv4);
strcat(host_ip, str); strcat(host_ip, str);
ipv4 = (utmp->ut_addr_v6[0] & 0x00000000ff000000) >> 24; ipv4 = (utmp->ut_addr_v6[0] & 0x00000000ff000000) >> 24;
sprintf( str, "%x", ipv4); sprintf( str, "%d", ipv4);
strcat(host_ip, str); strcat(host_ip, str);
}else }else
@ -226,8 +226,8 @@ int main()
char cmd[24]; char cmd[24];
char cmdline[1000]; char cmdline[1000];
char user[24]=""; char user[24]="";
char host_ip[42]; char host_ip[42]="";
char host_ipv6[42]; char host_ipv6[42]="";
char str[1024]; char str[1024];
char date[60]; char date[60];
time_t now ; time_t now ;