| |

VerySource

 Forgot password?
 Register
Search
View: 953|Reply: 5

NVT related issues

[Copy link]

1

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-1-9 13:00:01
| Show all posts |Read mode
Suddenly I want to make something that can be connected to telnet and play. But I found that telnet connection is no problem. But the control data sent by telnet has not been understood. That is, the NVT format (I understand it this way). The first few characters returned by telnet were control characters in NVT format. However, the content of these control characters has not been understood. There is no such thing as NVT specifications on the Internet.

#include <stdlib.h>
#include <stdio.h>
#include <WINSOCK2.H>
#include <process.h>

void main ()
{
SOCKET test;

int a = 0;

char buff [1024];

char orda [10];

WORD wVersion = MAKEWORD (2,0); // Define version

struct sockaddr_in ip_addr; // IP address

char addr [32] = "192.168.1.1"; // The entered IP address

WSADATA wsData;
Ranch
int nResult = WSAStartup (wVersion,&wsData);

memset (buff, 0, sizeof (buff));
memset (orda, 0, sizeof (orda));
// memset (addr, 0,32);
if (nResult! = 0)
{
printf ("WINSOCK EEROR\n");
system ("pause");
}

// printf ("Enter IP address:");
// gets (addr); // Enter the target machine address
// printf ("\n");


test = socket (AF_INET, SOCK_STREAM, 0); // Create a socket

if (test == INVALID_SOCKET)
{
exit (0);
}

ip_addr.sin_family = AF_INET;
ip_addr.sin_port = htons (23); // Port
ip_addr.sin_addr.S_un.S_addr = inet_addr (addr); // Address format conversion, connection address

a = connect (test, (struct sockaddr *)&ip_addr, sizeof (struct sockaddr_in)); // connect the target address
a = WSAGetLastError ();
if (0! = a)
{
printf ("Connection error!\n");
exit (0);
}

do
{
a = recv (test, buff, sizeof (buff), 0);

printf ("% s", buff);
memset (buff, 0, sizeof (buff));

gets (orda);

* (orda + strlen (orda)) = 13;

send (test, orda, strlen (orda) + 1, MSG_DONTROUTE);

memset (orda, 0, sizeof (orda));

memset (buff, 0, sizeof (buff));

Ranch
} while (1);
}

In this way, you can connect. You can also receive data. But the control characters in front of the data have not been understood. If you connect to it, telnet will immediately send back ff fd 01 ff fd 21 ff fb 03
Reply

Use magic Report

1

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 United States

 Author| Post time: 2020-1-22 11:45:01
| Show all posts
Does anyone know ?????????
Reply

Use magic Report

0

Threads

36

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-1-22 16:54:01
| Show all posts
Help you
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-17 09:00:01
| Show all posts
Oh, the nvt format, it looks like I researched a while ago, I'll help you check it out in the afternoon
Reply

Use magic Report

1

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-3-4 09:15:01
| Show all posts
Yes. Trouble
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-15 10:45:01
| Show all posts
Oh, remember, there is a description of nvt format characters in section 26.4 in the first volume of "Tcp / IP Detailed Explanation", from pages 302-304. You can take a look for yourself first and ask me if you do n’t understand.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list