Esempio n. 1
0
File: cheat.py Progetto: 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))
Esempio n. 2
0
File: cheat.py Progetto: 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))
Esempio n. 3
0
File: cheat.py Progetto: 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.')
Esempio n. 4
0
File: cheat.py Progetto: 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.')
Esempio n. 5
0
File: cheat.py Progetto: 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()
Esempio 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)

Esempio 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
Esempio n. 8
0
File: ftp.py Progetto: 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:
Esempio 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 = []
Esempio n. 10
0
File: cheat.py Progetto: 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()
Esempio 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
Esempio 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()
Esempio n. 13
0
#@help:clear - clears the display. This command does not delete the command history
from game.pythonapi import PyDisplay

PyDisplay.clear(terminal)
Esempio n. 14
0
File: ftp.py Progetto: 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
Esempio n. 15
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)
Esempio n. 16
0
File: cheat.py Progetto: 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')
Esempio n. 17
0
File: history.py Progetto: 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)

Esempio n. 18
0
File: cheat.py Progetto: 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')
Esempio n. 19
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 = []

Esempio n. 20
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()