Re: How to send a sequence of bytes

"John Chajecki" <[email protected]>
Newsgroups gmane.comp.security.nessus.general
Message-ID <[email protected]>
Renaud,

Curious. I tried that but it literally sent the string 0x31,0x00,0x30,......etc rather than the actual hex bytes represented by string.
I have attached the Wireshark screen grab.

Here is my code.

pktdata = '
0x31,0x00,0x30,0x00,0x33,0x00,0x3b,0x00,0x38,0x00,0x36,0x00,0x3b,0x00,
0x31,0x00,0x2e,0x00,0x30,0x00,0x2e,0x00,0x30,0x00,0x2e,0x00,0x30,0x00';


port = 15000;
soc = open_sock_udp(port);
if (soc) {
  send(socket:soc, data:raw_string(pktdata));
}
r = recv(socket:soc, length=1024);
if (r) display ("Response received\n");
close(soc);



_
John Chajecki
Senior Infrastructure Engineer
Information Division
Resources Department
Leicester City Council

>>> "Renaud Deraison (lists)" <[email protected]> 22/05/2008 16:35 >>>

John,

On May 22, 2008, at 4:15 PM, John Chajecki wrote:

> In trying to create a custom plugin, I have the need to send a  
> sequence of bytes as the data in a packet.
>
> I know the exact sequence of hex bytes to be:
>
>  31,00,30,00,33,00,3b,00,38,00,36,00,3b,00,31,00,2e,00,30,00,2e, 
> 00,30,00,2e,00,30
>
> The problem is that I can't find a way of converting that  
> representation into a suitable string to pass to the send command:
>
>   send(socket:soc, data:pktdata);
>
> Is there a function in nasl that can do the conversion?

You'd do :

send(socket:soc, data:raw_string(0x31, 0x00, 0x30, ....., 0x2e, 0x00,  
0x30));


				-- Renaud

_______________________________________________
Nessus mailing list
[email protected]
http://mail.nessus.org/mailman/listinfo/nessus
capture.jpg (image/jpeg, 92.9 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.