Finger was a tool/service used by hosts to prive information about their users. In the last years, it has been put off because it was a good point to begin with for hackers.
This afternoon I was bored and I coded a simple fake finger service which shows a finger to anyone fingering the host. This is it:
#include <stdlib.h>
#include <stdio.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
int main(int argc, char *argv[])
{
char finger[]="\n\
Servidor de Ca0s /\"\\\n\
[url=http://www.ka0labs.org]www.ka0labs.org[/url] |\\./|\n\
| |\n\
| |\n\
|>~<|\n\
| |\n\
/'\\| |/'\\..\n\
Insanity /~\\| | | | \\\n\
for | =[@]= | | \\\n\
the | | | | | \\\n\
win | ~ ~ ~ ~ |` )\n\
| /\n\
\\ /\n\
\\ /\n\
\\ _____ /\n\
Buscabas |--//''`\\--|\n\
algo? | (( +==)) |\n\
|--\\_|_//--|\n\n\n";
struct sockaddr_in data, con;
memset(&data, 0, sizeof(data));
data.sin_family=AF_INET;
data.sin_port=htons(79);
data.sin_addr.s_addr=INADDR_ANY;
int s0ck=socket(AF_INET, SOCK_STREAM, 0);
if(s0ck<0)
{
printf("Error sock()\n");
return 0;
}
if(bind(s0ck, (struct sockaddr *)&data, sizeof(data))<0)
{
printf("Error bind())\n");
return 0;
}
listen(s0ck, 5);
int c0n=0;
int cSize=sizeof(struct sockaddr_in);
char buf[2]="\x00\x00";
char ip[32];
while(c0n=accept(s0ck, (struct sockaddr *)&con, &cSize))
{
inet_ntop(AF_INET, &(con.sin_addr), &ip);
printf("[+] Access from %s\n", ip);
recv(c0n, buf, 1, 0);
send(c0n, finger, strlen(finger), 0);
close(c0n);
}
return 0;
}