forked from detexploit/DetExploit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
35 lines (30 loc) · 1.16 KB
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
###########################################################
# utils.py
# Utility script file of DetExploit.
# DetExploit (https://github.com/moppoi5168/DetExploit)
# Licensed by GPL License
###########################################################
import configparser
import ctypes
import os
import sys
def config_test(cp):
exploitdb_filename = cp.get('exploitdb', 'vulndata_filename')
try:
with open(exploitdb_filename, 'w') as tf:
tf.write('Hello, World.')
os.path.isfile(exploitdb_filename)
os.remove(exploitdb_filename)
except:
print('Error: Cannnot generate ExploitDB vulnerability data file.')
print('Error: Check filename in config.ini')
exit(1)
def is_admin():
is_admin = ctypes.windll.shell32.IsUserAnAdmin()
if is_admin != 0:
try:
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1)
except:
print('Error: You need administrator privilege to run this scan!!')
print('Error: Please run cmd.exe in administrator privilege.')
print('Error: Or, you may run program with --no-admin-priv.')