MCPcopy Index your code
hub / github.com/AutoRecon/AutoRecon / cprint

Function cprint

autorecon/io.py:22–71  ·  view source on GitHub ↗
(*args, color=Fore.RESET, char='*', sep=' ', end='\n', frame_index=1, file=sys.stdout, printmsg=True, verbosity=0, **kvargs)

Source from the content-addressed store, hash-verified

20 return e(s, frame_index=3)
21
22def cprint(*args, color=Fore.RESET, char='*', sep=' ', end='\n', frame_index=1, file=sys.stdout, printmsg=True, verbosity=0, **kvargs):
23 if printmsg and verbosity > config['verbose']:
24 return ''
25 frame = sys._getframe(frame_index)
26
27 vals = {
28 'bgreen': Fore.GREEN + Style.BRIGHT,
29 'bred': Fore.RED + Style.BRIGHT,
30 'bblue': Fore.BLUE + Style.BRIGHT,
31 'byellow': Fore.YELLOW + Style.BRIGHT,
32 'bmagenta': Fore.MAGENTA + Style.BRIGHT,
33
34 'green': Fore.GREEN,
35 'red': Fore.RED,
36 'blue': Fore.BLUE,
37 'yellow': Fore.YELLOW,
38 'magenta': Fore.MAGENTA,
39
40 'bright': Style.BRIGHT,
41 'srst': Style.NORMAL,
42 'crst': Fore.RESET,
43 'rst': Style.NORMAL + Fore.RESET
44 }
45
46 if config['accessible']:
47 vals = {'bgreen':'', 'bred':'', 'bblue':'', 'byellow':'', 'bmagenta':'', 'green':'', 'red':'', 'blue':'', 'yellow':'', 'magenta':'', 'bright':'', 'srst':'', 'crst':'', 'rst':''}
48
49 vals.update(frame.f_globals)
50 vals.update(frame.f_locals)
51 vals.update(kvargs)
52
53 unfmt = ''
54 if char is not None and not config['accessible']:
55 unfmt += color + '[' + Style.BRIGHT + char + Style.NORMAL + ']' + Fore.RESET + sep
56 unfmt += sep.join(args)
57
58 fmted = unfmt
59
60 for attempt in range(10):
61 try:
62 fmted = string.Formatter().vformat(unfmt, args, vals)
63 break
64 except KeyError as err:
65 key = err.args[0]
66 unfmt = unfmt.replace('{' + key + '}', '{{' + key + '}}')
67
68 if printmsg:
69 print(fmted, sep=sep, end=end, file=file)
70 else:
71 return fmted
72
73def debug(*args, color=Fore.GREEN, sep=' ', end='\n', file=sys.stdout, **kvargs):
74 if config['verbose'] >= 2:

Callers 9

port_scanFunction · 0.90
service_scanFunction · 0.90
generate_reportFunction · 0.90
scan_targetFunction · 0.90
debugFunction · 0.85
infoFunction · 0.85
warnFunction · 0.85
errorFunction · 0.85
failFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected