Results 1 to 5 of 5

Thread: Sending a packet with Perl under Windows?

  1. #1
    Moderator KMDave's Avatar
    Join Date
    Jan 2010
    Posts
    2,281

    Default Sending a packet with Perl under Windows?

    Hello everyone,

    I am currently developing my portknocking client for Windows with Perl.
    Unfortunately I can't use the Net::RawIP module I am using for the Linux client.

    Does anyone know if there is a module for Perl under Windows I can use to craft my own package? (Just need to add the destination IP/port and tcp payload). I don't need to change the sender IP or alike.

    The only problem is, I can't make a connection to the destination since all packets will be dropped and that way I can't establish a connection. I need to create a "fire-and-forget-packet".

    Thanks in advance.

    Edit:
    Ok, small mistake, I will just go ahead and use UDP packages and also use it to see if a linux or windows machine is knocking
    Tiocfaidh ár lá

  2. #2
    Junior Member the_rooster's Avatar
    Join Date
    Apr 2008
    Posts
    25

    Default

    I've seen some very nice perl scripts that do in 5 lines what it takes 100 lines of java to do. But for me, it just isn't documented as well as java. If you are open to doing it java, it is very easy to fire off a udp packet.


    DatagramSocket ds = new DatagramSocket(<srcPort> , <srcIPAddress>);
    DatagramPacket packet = new DatagramPacket(<payload as byte[]> , <payload length> , <dstIPAddress>, <dstPort>);
    ds.send(packet);
    ds.close();

  3. #3
    Moderator KMDave's Avatar
    Join Date
    Jan 2010
    Posts
    2,281

    Default

    Thanks for the advice

    I've already implemented it in Perl. Just working on the frontend right now.
    My issue was that I was just thinking of a tcp connection at first instead of udp
    Tiocfaidh ár lá

  4. #4
    JMC31337
    Guest

    Default

    ok first of all lemme get some stuff of my chest

    i like windows only b/c of the battle between SUN and M$ over JAVA leading to the MYDOOM fiasco

    that being said... forget winbloze!! lol!!! this is a LINUX board

  5. #5
    Very good friend of the forum Virchanza's Avatar
    Join Date
    Jan 2010
    Posts
    863

    Default

    Regarding doing networking programming under MS Windows, well you have to watch out for something. The default networking library under MS Windows is Winsock, however recently its ability to open "raw sockets" has been removed. Therefore you won't be able to use it to send and receive custom Ethernet frames.

    To get around this, you've to use a 3rd party library; I myself used Winpcap at a time when I was programming for Windows.

    I've seen some very nice perl scripts that do in 5 lines what it takes 100 lines of java to do.
    You're confusing a) an actual programming language with b) the libraries available for a programming language.

    For instance, let's say it's takes you 583 lines of code to achieve a particular objective in C. Now let's say I take these 583 lines of code and make a library out of it so that everybody else just has to type one line to get it to work. C and C++ have by far the most libraries available, so if you're into writing one-liner programs then all you need to do is Google for the necessary libraries.
    Ask questions on the open forums, that way everybody benefits from the solution, and everybody can be corrected when they make mistakes. Don't send me private messages asking questions that should be asked on the open forums, I won't respond. I decline all "Friend Requests".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •