MCPcopy Create free account
hub / github.com/RUB-NDS/PRET / printer

Class printer

printer.py:25–844  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24
25class printer(cmd.Cmd, object):
26 # cmd module config and customization
27 intro = "Welcome to the pret shell. Type help or ? to list commands."
28 doc_header = "Available commands (type help <topic>):"
29 offline_str = "Not connected."
30 undoc_header = None
31 # do not change
32 logfile = None
33 debug = False
34 status = False
35 quiet = False
36 fuzz = False
37 conn = None
38 mode = None
39 error = None
40 iohack = True
41 timeout = 10
42 target = ""
43 vol = ""
44 cwd = ""
45 traversal = ""
46 # can be changed
47 editor = "vim" # set to nano/edit/notepad/leafpad/whatever
48
49 # --------------------------------------------------------------------
50 def __init__(self, args):
51 # init cmd module
52 cmd.Cmd.__init__(self)
53 self.debug = args.debug # debug mode
54 self.quiet = args.quiet # quiet mode
55 self.mode = args.mode # command mode
56 # connect to device
57 self.do_open(args.target, "init")
58 # log pjl/ps cmds to file
59 if args.log:
60 self.logfile = log().open(args.log)
61 header = None
62 if self.mode == "ps":
63 header = c.PS_HEADER
64 if self.mode == "pcl":
65 header = c.PCL_HEADER
66 if header:
67 log().write(self.logfile, header + os.linesep)
68 # run pret cmds from file
69 if args.load:
70 self.do_load(args.load)
71 # input loop
72 self.cmdloop()
73
74 def set_defaults(self, newtarget):
75 self.fuzz = False
76 if newtarget:
77 self.set_vol()
78 self.set_traversal()
79 self.error = None
80 else:
81 self.set_prompt()
82

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected