@@ -76,25 +76,24 @@ def add_virt(
76
76
77
77
def _info (binary , color = True ) -> str :
78
78
from pwnlib .elf .elf import ELF
79
+ from pwnlib .term import text
80
+
81
+ red = text .red if color else str
82
+ green = text .green if color else str
79
83
80
84
exe = ELF (binary , checksec = False )
81
85
out = list ()
82
- out .append ("Arch: " )
83
- arch = "-" .join ((exe .arch , str (exe .bits ), exe .endian ))
84
- if color :
85
- arch = typer .style (arch , fg = typer .colors .GREEN )
86
+ out .append ("Arch:" .ljust (12 ))
87
+ arch = green ("-" .join ((exe .arch , str (exe .bits ), exe .endian )))
86
88
out .append (arch )
87
89
out .append ("\n " )
88
90
out .append (exe .checksec (color = color ))
89
- out .append ("\n Comment: " )
91
+ out .append ("\n " )
92
+ out .append ("Comment:" .ljust (12 ))
90
93
if exe .get_section_by_name (".comment" ) is not None :
91
- comment = exe .section (".comment" ).replace (b"\0 " , b"" ).decode ()
92
- if color :
93
- comment = typer .style (comment , fg = typer .colors .GREEN )
94
+ comment = green (exe .section (".comment" ).replace (b"\0 " , b"" ).decode ())
94
95
else :
95
- comment = "No Comment"
96
- if color :
97
- comment = typer .style (comment , fg = typer .colors .RED )
96
+ comment = red ("No Comment" )
98
97
99
98
out .append (comment )
100
99
return "" .join (out )
@@ -213,7 +212,7 @@ def template(
213
212
214
213
if not no_info :
215
214
try :
216
- info = "# " + "\n # " .join (_info (binary , color = False ).splitlines ())
215
+ info = "# " + "\n # " .join (_info (binary , color = False ).splitlines ()) + " \n "
217
216
except Exception :
218
217
info = ""
219
218
else :
0 commit comments