Ejemplo n.º 1
0
Archivo: cheat.py Proyecto: Rsgm/Hakd
def open_port():
	if len(parameters) != 3:
		PyDisplay.write(terminal, 'Missing arguments.')
	else:
		ip = parameters[0]
		program = parameters[1]
		port = int(parameters[2])

		d = PyNetworking.get_device(ip)
		d.openPort(Port(program, port))
Ejemplo n.º 2
0
Archivo: cheat.py Proyecto: ttbel/Hakd
def open_port():
    if len(parameters) != 3:
        PyDisplay.write(terminal, 'Missing arguments.')
    else:
        ip = parameters[0]
        program = parameters[1]
        port = int(parameters[2])

        d = PyNetworking.get_device(ip)
        d.openPort(Port(program, port))
Ejemplo n.º 3
0
Archivo: cheat.py Proyecto: Rsgm/Hakd
def close_port():
	if len(parameters) != 2:
		PyDisplay.write(terminal, 'Missing arguments.')
	else:
		ip = parameters[0]
		port = int(parameters[1])

		d = PyNetworking.get_device(ip)
		try:
			d.closePort(port)
		except IOError:
			PyDisplay.write(terminal, 'Port does not exist.')
Ejemplo n.º 4
0
Archivo: cheat.py Proyecto: ttbel/Hakd
def close_port():
    if len(parameters) != 2:
        PyDisplay.write(terminal, 'Missing arguments.')
    else:
        ip = parameters[0]
        port = int(parameters[1])

        d = PyNetworking.get_device(ip)
        try:
            d.closePort(port)
        except IOError:
            PyDisplay.write(terminal, 'Port does not exist.')
Ejemplo n.º 5
0
Archivo: cheat.py Proyecto: Rsgm/Hakd
		d.openPort(Port(program, port))

def close_port():
	if len(parameters) != 2:
		PyDisplay.write(terminal, 'Missing arguments.')
	else:
		ip = parameters[0]
		port = int(parameters[1])

		d = PyNetworking.get_device(ip)
		try:
			d.closePort(port)
		except IOError:
			PyDisplay.write(terminal, 'Port does not exist.')

try:
	parameters
except NameError:
	PyDisplay.write(terminal, 'Please provide some arguments. Type -h for help.')

else:
	p = parameters[0]
	del parameters[0]

	if p == '-h':
		help()
	elif p == 'open_port':
		open_port()
	elif p == 'close_port':
		close_port()
Ejemplo n.º 6
0
#@help:port_scan [ip] - Scans for open ports on the specified device.
from game.pythonapi import PyNetworking
from game.pythonapi import PyDisplay

ip = parameters[0]
d = PyNetworking.get_device(ip)

PyDisplay.write(terminal, "Ports Open on the device with the ip " + ip + ":")

ports = d.getPorts()
if len(ports)==0:
	PyDisplay.write(terminal, "No ports are open.")

for p in ports:
	s = str(p.getPortNumber()) + " - "
	s+= str(p.getProgram())
	s+= " (" + str(p.getProtocol()) + ")"
	PyDisplay.write(terminal, s)

#def help():
	# port_number - program (protocol)

Ejemplo n.º 7
0
    #This program is distributed in the hope that it will be useful,
    #but WITHOUT ANY WARRANTY; without even the implied warranty of
    #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    #GNU General Public License for more details.

    #You should have received a copy of the GNU General Public License
    #along with this program.  If not, see <http://www.gnu.org/licenses/>.


#I did edit this enough to run with hakd. the orriginal can be found here http://sourceforge.net/projects/pythontextadven/files/?source=navbar
#-rsgm

from game.pythonapi import PyDisplay

PyDisplay.write(terminal, "Welcome to the Adventure Game, here you will embark on a dangerous journey to defeat the evil Dragon named Kibbles, and rescue Princess Catherine, You're story begins in the small town of Jersey, type the commands north, south, east, and west in order to navigate,type the command use followed by the item name to use an item, type the command inventory to look at the items in your posession, type the command look to look around you, type the command search followed by a target to search for people or items, type the command commands to repeat these directions. Good luck")


items=[]

place=1

town=2

forest=3

mine=4

lair=5

dead=6
Ejemplo n.º 8
0
Archivo: ftp.py Proyecto: ttbel/Hakd
            while device.getPorts().containsKey(i):
                i = random.randint(40000, 65536)
            port = Port('ftp', i)
            device.openPort(port)
    else:
        port = Port('ftp', 21)
        device.openPort(port)

    server.connect(terminal.device, port, 21)
#except NameError:
#	PyDisplay.write(terminal, 'Please provide the IP of the ftp server.')
#
except IOError:
    terminal.device.closePort(21)
    PyDisplay.write(
        terminal,
        'I/O Error - Port may be in use, or there was an error connecting.')

else:
    PyDisplay.write(terminal, '')
    connection = terminal.device.getConnections().get(ip)
    port = connection.getClientPort()
    input_list = port.getIn()
    PyDisplay.write(terminal, '\n')

    while input_list.isEmpty():
        time.sleep(.25)
    length = port.read()
    i = 0

    while i < length:
Ejemplo n.º 9
0
    device.openPort(Port('ftp server', 21, 'ftp'))
connections = list(device.getConnections().values())

while server_running:
    time.sleep(1)

    new_set = set(list(device.getConnections().values()))
    old_set = set(connections)

    print new_set
    print old_set

    new_connections = list(new_set - old_set)
    print new_connections

    connections = list(device.getConnections().values())

    for c in new_connections:
        PyDisplay.write(terminal,
                        'New connection from: ' + c.getClient().getIp())
        try:
            t = Thread(target=server_thread, args=(c, ))
            #t.daemon = True
            t.start()
        except:
            PyDisplay.write(terminal, 'Error: unable to start thread')
            print 'Error: unable to start thread on server ' + str(
                device.getIp())
            c.close()
    new_connections = []
Ejemplo n.º 10
0
Archivo: cheat.py Proyecto: ttbel/Hakd
def close_port():
    if len(parameters) != 2:
        PyDisplay.write(terminal, 'Missing arguments.')
    else:
        ip = parameters[0]
        port = int(parameters[1])

        d = PyNetworking.get_device(ip)
        try:
            d.closePort(port)
        except IOError:
            PyDisplay.write(terminal, 'Port does not exist.')


try:
    parameters
except NameError:
    PyDisplay.write(terminal,
                    'Please provide some arguments. Type -h for help.')

else:
    p = parameters[0]
    del parameters[0]

    if p == '-h':
        help()
    elif p == 'open_port':
        open_port()
    elif p == 'close_port':
        close_port()
Ejemplo n.º 11
0
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with this program.  If not, see <http://www.gnu.org/licenses/>.

#I did edit this enough to run with hakd. the orriginal can be found here http://sourceforge.net/projects/pythontextadven/files/?source=navbar
#-rsgm

from game.pythonapi import PyDisplay

PyDisplay.write(
    terminal,
    "Welcome to the Adventure Game, here you will embark on a dangerous journey to defeat the evil Dragon named Kibbles, and rescue Princess Catherine, You're story begins in the small town of Jersey, type the commands north, south, east, and west in order to navigate,type the command use followed by the item name to use an item, type the command inventory to look at the items in your posession, type the command look to look around you, type the command search followed by a target to search for people or items, type the command commands to repeat these directions. Good luck"
)

items = []

place = 1

town = 2

forest = 3

mine = 4

lair = 5

dead = 6
Ejemplo n.º 12
0
from game.pythonapi import PyDisplay
from game.pythonapi import PyNetworking

connections = terminal.device.getConnections()
PyDisplay.write(terminal,
                'Disconnecting from ' + str(len(connections)) + ' device(s).')
for c in connections.values():
    c.close()
Ejemplo n.º 13
0
Archivo: ftp.py Proyecto: Rsgm/Hakd
			i = random.randint(40000, 65536)
			while device.getPorts().containsKey(i):
				i = random.randint(40000, 65536)
			port = Port('ftp', i)
			device.openPort(port)
	else:
		port = Port('ftp', 21)
		device.openPort(port)

	server.connect(terminal.device, port, 21)
#except NameError:
#	PyDisplay.write(terminal, 'Please provide the IP of the ftp server.')
#
except IOError:
	terminal.device.closePort(21)
	PyDisplay.write(terminal, 'I/O Error - Port may be in use, or there was an error connecting.')

else:
	PyDisplay.write(terminal, '')
	connection = terminal.device.getConnections().get(ip)
	port = connection.getClientPort()
	input_list = port.getIn()
	PyDisplay.write(terminal, '\n')

	while input_list.isEmpty():
		time.sleep(.25)
	length = port.read()
	i = 0

	while i < length:
		i += 1
Ejemplo n.º 14
0
#@help:history {show|clear} - Scans for open ports on the specified device.
from game.pythonapi import PyDisplay

try:
    parameters
except NameError:
    PyDisplay.write(terminal, 'Please specify either show or clear.')

else:
    if parameters[0] == 'clear':
        terminal.getHistory().clear()
        terminal.setLine(0)
    else:
        history = terminal.getHistory()
        PyDisplay.write(terminal, 'Command history:')

        for s in history:
            PyDisplay.write(terminal, '   ' + s)
Ejemplo n.º 15
0
Archivo: cheat.py Proyecto: Rsgm/Hakd
def help():
	PyDisplay.write(terminal, 'Programs available:' +
	'\n   open_port {target IP} {program} {port} - opens a port on the device' +
	'\n   close_port {target IP} {port} - connects to the device')
Ejemplo n.º 16
0
Archivo: history.py Proyecto: Rsgm/Hakd
#@help:history {show|clear} - Scans for open ports on the specified device.
from game.pythonapi import PyDisplay

try:
	parameters
except NameError:
	PyDisplay.write(terminal, 'Please specify either show or clear.')

else:
	if parameters[0] == 'clear':
		terminal.getHistory().clear()
		terminal.setLine(0)
	else:
		history = terminal.getHistory()
		PyDisplay.write(terminal, 'Command history:')

		for s in history:
			PyDisplay.write(terminal, '   ' + s)

Ejemplo n.º 17
0
Archivo: cheat.py Proyecto: ttbel/Hakd
def help():
    PyDisplay.write(
        terminal, 'Programs available:' +
        '\n   open_port {target IP} {program} {port} - opens a port on the device'
        + '\n   close_port {target IP} {port} - connects to the device')
Ejemplo n.º 18
0
else:
	device.openPort(Port('ftp server', 21, 'ftp'))
connections = list(device.getConnections().values())

while server_running:
	time.sleep(1)

	new_set = set(list(device.getConnections().values()))
	old_set = set(connections)

	print new_set
	print old_set

	new_connections = list(new_set - old_set)
	print new_connections

	connections = list(device.getConnections().values())

	for c in new_connections:
		PyDisplay.write(terminal, 'New connection from: ' + c.getClient().getIp())
		try:
			t = Thread(target=server_thread, args=(c,))
			#t.daemon = True
			t.start()
		except:
		   PyDisplay.write(terminal, 'Error: unable to start thread')
		   print 'Error: unable to start thread on server ' + str(device.getIp())
		   c.close()
	new_connections = []

Ejemplo n.º 19
0
from game.pythonapi import PyDisplay
from game.pythonapi import PyNetworking

connections = terminal.device.getConnections()
PyDisplay.write(terminal, 'Disconnecting from ' + str(len(connections)) + ' device(s).')
for c in connections.values():
	c.close()