Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Background scan, network test passed

Shulou Source: shulou.com Published: 2022-06-01 06:42:38 10月03日 Update

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# define LINE 1024

# define dict "dict.txt"

# define result "manager.txt"

Int main (int argc,char * argv []) {

Int sc,fd

Unsigned short port = 80

Struct sockaddr_in add;struct in_addr in

Char * ip

Struct hostent * host

Char rheader [LINE], dictbuf [LINE], resbuf [LINE]

Char * dir,path [LINE] = "", * arr [LINE], * tmp,state [3], manager [LINE]

Int iBoth 0rec jrem nomenclature 0Bytes

If (argc! = 2) {

Printf ("please input domain.\ r\ n")

Return

}

Dir = get_current_dir_name ()

Strcat (path,dir)

Strcat (path, "/")

Strcat (path,dict)

Fd = open (path,O_RDONLY)

Read (fd,dictbuf,sizeof (dictbuf))

Close (fd)

Arr [nasty +] = strtok (dictbuf, "\ r\ n")

While (tmp=strtok (NULL, "\ r\ n") arr [nasty +] = tmp

Ip = malloc

Memset (ip,'\ 0subsection 512)

Sc = socket (AF_INET,SOCK_STREAM,0)

If (sc =-1) {

Printf ("create socket fail!\ r\ n")

Return

}

Bzero (& add,sizeof (add))

Add.sin_family=AF_INET

Add.sin_port=htons (port)

Bzero (& path,sizeof (path))

Strcat (path,dir)

Strcat (path, "/")

Strcat (path,result)

Fd = open (path,O_WRONLY | O_CREAT | unloaded APPEND Shop IRWXU)

If (! (host=gethostbyname (argv [1]) {

Fprintf (stderr, "Can`t resolve host.\ n")

Exit (1)

}

Memcpy (& add.sin_addr.s_addr,host- > h_addr_list [0], 4)

In.s_addr = add.sin_addr.s_addr

Printf ("IP:%s\ n", ip=inet_ntoa (in))

Add.sin_addr.s_addr=inet_addr (ip)

If (connect (sc, (struct sockaddr *) (& add), sizeof (struct sockaddr)) =-1) {

Printf ("conn fail!\ r\ n")

Return-1

}

For (; I)

Tags: Backstage Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Redmi MariaDB OPPO Reno Microsoft