WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to work with sockets?  (Read 3635 times)

Offline bonbob

  • Jr. Member
  • **
  • Posts: 99
How to work with sockets?
« on: August 24, 2018, 11:48:14 PM »
I need work with sockets directly, but

Code: [Select]
exec 11<>/dev/tcp/google.net/80
return

Code: [Select]
-sh: can't create /dev/tcp/google.net/80: nonexistent directory
There is no /dev/tcp or /dev/udp directories in CorePure64. Making this directories manually do not create tcp/udp   sockets. Only simple text-file.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 662
Re: How to work with sockets?
« Reply #1 on: August 25, 2018, 12:13:02 AM »
Have you tried with another shell like bash.
And have you tried to execute with root access.

Have seen som exaple of bash code like this

Code: (bash) [Select]
bash$ exec 5<>/dev/tcp/www.google.net/80
bash$ echo -e "GET / HTTP/1.0\n" >&5
bash$ cat <&5

Offline bonbob

  • Jr. Member
  • **
  • Posts: 99
Re: How to work with sockets?
« Reply #2 on: August 25, 2018, 12:58:03 AM »
I think bash compiled without --enable-net-redirections option.
So it has no support of socket device virtual files mechanism

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: How to work with sockets?
« Reply #3 on: August 25, 2018, 07:00:17 AM »
Hi bonbob
Maybe the  nc  command which is part of  busybox  would work for you? If you want to write your own utility, maybe try
reading  Beej's Guide to Network Programming. It's clearly written with easy to understand examples suitable for beginners.
It can be found here:
http://beej.us/guide/
Without a better description of what you are trying to accomplish it's difficult to provide relevant suggestions.

Offline bonbob

  • Jr. Member
  • **
  • Posts: 99
Re: How to work with sockets?
« Reply #4 on: August 26, 2018, 02:38:34 AM »
netcat is the solution for my question.
Thanks!