Skip to content

Commit 854c9dc

Browse files
author
rdmmf
committed
clean up for release 0.1.0
1 parent 47d5aab commit 854c9dc

28 files changed

+219
-225
lines changed

ghidra_scripts/GUI-MISP-fetch-comments-for-all-functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
if lib_dir not in sys.path:
1313
sys.path.append(lib_dir)
1414

15+
logging.basicConfig(level=logging.INFO)
1516
logger = logging.getLogger(__name__)
16-
logger.setLevel(logging.DEBUG)
1717

1818
import mispghidra.PyMISPGhidraScripts as PyMISPGhidraScripts
1919

@@ -28,7 +28,7 @@
2828
# Default args
2929
PyMISPGhidraScripts.search_functions_in_misp(
3030
all_functions=True,
31-
ignored_functions=["thunks"],
31+
ignored_functions=["thunk"],
3232
state=state,
3333
interpreter=get_current_interpreter(),
3434
monitor=monitor,

ghidra_scripts/GUI-MISP-fetch-comments-for-current-function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
if lib_dir not in sys.path:
1414
sys.path.append(lib_dir)
1515

16+
logging.basicConfig(level=logging.INFO)
1617
logger = logging.getLogger(__name__)
17-
logger.setLevel(logging.DEBUG)
1818

1919
import mispghidra.PyMISPGhidraScripts as PyMISPGhidraScripts
2020

ghidra_scripts/GUI-MISP-fetch-comments-for-current-selection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
if lib_dir not in sys.path:
1414
sys.path.append(lib_dir)
1515

16+
logging.basicConfig(level=logging.INFO)
1617
logger = logging.getLogger(__name__)
17-
logger.setLevel(logging.DEBUG)
1818

1919
import mispghidra.PyMISPGhidraScripts as PyMISPGhidraScripts
2020

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Recreate call tree in MISP
2+
# @author Thomas Caillet @rdmmf
3+
# @category MISP.ghidra-function
4+
# @keybinding
5+
# @menupath MISP.Send to MISP.Call Tree.Recreate call tree in MISP
6+
# @toolbar misp.png
7+
# @runtime PyGhidra
8+
9+
import time, logging, argparse, importlib, os, sys
10+
11+
# Add library folder to sys.path
12+
lib_dir = os.path.join(os.path.dirname(__file__), "..")
13+
if lib_dir not in sys.path:
14+
sys.path.append(lib_dir)
15+
16+
logging.basicConfig(level=logging.INFO)
17+
logger = logging.getLogger(__name__)
18+
19+
import mispghidra.PyMISPGhidraScripts as PyMISPGhidraScripts
20+
21+
importlib.reload(PyMISPGhidraScripts)
22+
23+
from pyghidra import get_current_interpreter
24+
25+
if __name__ == "__main__":
26+
27+
start = time.time()
28+
29+
PyMISPGhidraScripts.create_call_tree(state, get_current_interpreter(), monitor)
30+
31+
end = time.time()
32+
logger.info(f"Operation took {end - start:.6f} seconds")

ghidra_scripts/GUI-ghidra-all-functions-to-MISP.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
if lib_dir not in sys.path:
1515
sys.path.append(lib_dir)
1616

17+
logging.basicConfig(level=logging.INFO)
1718
logger = logging.getLogger(__name__)
18-
logger.setLevel(logging.DEBUG)
1919

2020
import mispghidra.PyMISPGhidraScripts as PyMISPGhidraScripts
2121

ghidra_scripts/GUI-ghidra-current-function-to-MISP.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
if lib_dir not in sys.path:
1515
sys.path.append(lib_dir)
1616

17+
logging.basicConfig(level=logging.INFO)
1718
logger = logging.getLogger(__name__)
18-
logger.setLevel(logging.DEBUG)
1919

2020
import mispghidra.PyMISPGhidraScripts as PyMISPGhidraScripts
2121

ghidra_scripts/GUI-ghidra-current-selection-functions-to-MISP.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
if lib_dir not in sys.path:
1515
sys.path.append(lib_dir)
1616

17+
logging.basicConfig(level=logging.INFO)
1718
logger = logging.getLogger(__name__)
18-
logger.setLevel(logging.DEBUG)
1919

2020
import mispghidra.PyMISPGhidraScripts as PyMISPGhidraScripts
2121

ghidra_scripts/GUI-ghidra-functions-to-MISP.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
if lib_dir not in sys.path:
1414
sys.path.append(lib_dir)
1515

16+
logging.basicConfig(level=logging.INFO)
1617
logger = logging.getLogger(__name__)
17-
logger.setLevel(logging.DEBUG)
1818

1919
import mispghidra.PyMISPGhidraScripts as PyMISPGhidraScripts
2020

ghidra_scripts/test-MISP-API.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
import time, datetime, logging
3535

36+
logging.basicConfig(level=logging.INFO)
3637
logger = logging.getLogger(__name__)
3738

3839

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,13 @@
66
# @toolbar misp.png
77
# @runtime PyGhidra
88

9-
# TODO seperate GUI and Headless
10-
119
import time, logging, argparse, importlib, os, sys
1210

1311
# Add library folder to sys.path
1412
lib_dir = os.path.join(os.path.dirname(__file__), "..")
1513
if lib_dir not in sys.path:
1614
sys.path.append(lib_dir)
1715

18-
logger = logging.getLogger(__name__)
19-
2016
import mispghidra.PyMISPGhidraScripts as PyMISPGhidraScripts
2117

2218
importlib.reload(PyMISPGhidraScripts)
@@ -32,7 +28,25 @@
3228
parser.add_argument(
3329
"--event-uuid", type=str, default=None, help="The MISP Event UUID"
3430
)
31+
parser.add_argument(
32+
"-v",
33+
"--verbose",
34+
dest="verbose",
35+
default=0,
36+
help="increase output verbosity",
37+
action="count",
38+
)
39+
3540
args = parser.parse_args(args_list)
41+
if args.verbose == 0:
42+
level = logging.WARNING
43+
elif args.verbose == 1:
44+
level = logging.INFO
45+
else:
46+
level = logging.DEBUG
47+
48+
logging.basicConfig(level=level)
49+
logger = logging.getLogger(__name__)
3650

3751
PyMISPGhidraScripts.create_call_tree(
3852
state, get_current_interpreter(), monitor, args.event_uuid

0 commit comments

Comments
 (0)