Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Background scan, network test passed

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

# 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)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report