mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-25 11:03:47 +03:00
Code refactoring (moving import ctypes to be used only when needed)
This commit is contained in:
parent
3e0f747fad
commit
c1592e8508
|
@ -9,7 +9,6 @@ import codecs
|
||||||
import contextlib
|
import contextlib
|
||||||
import cookielib
|
import cookielib
|
||||||
import copy
|
import copy
|
||||||
import ctypes
|
|
||||||
import httplib
|
import httplib
|
||||||
import inspect
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
|
@ -2209,6 +2208,8 @@ def runningAsAdmin():
|
||||||
|
|
||||||
isAdmin = isinstance(_, (int, float, long)) and _ == 0
|
isAdmin = isinstance(_, (int, float, long)) and _ == 0
|
||||||
elif IS_WIN:
|
elif IS_WIN:
|
||||||
|
import ctypes
|
||||||
|
|
||||||
_ = ctypes.windll.shell32.IsUserAnAdmin()
|
_ = ctypes.windll.shell32.IsUserAnAdmin()
|
||||||
|
|
||||||
isAdmin = isinstance(_, (int, float, long)) and _ == 1
|
isAdmin = isinstance(_, (int, float, long)) and _ == 1
|
||||||
|
|
3
thirdparty/ansistrm/ansistrm.py
vendored
3
thirdparty/ansistrm/ansistrm.py
vendored
|
@ -1,7 +1,6 @@
|
||||||
#
|
#
|
||||||
# Copyright (C) 2010-2012 Vinay Sajip. All rights reserved. Licensed under the new BSD license.
|
# Copyright (C) 2010-2012 Vinay Sajip. All rights reserved. Licensed under the new BSD license.
|
||||||
#
|
#
|
||||||
import ctypes
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
@ -84,6 +83,8 @@ class ColorizingStreamHandler(logging.StreamHandler):
|
||||||
}
|
}
|
||||||
|
|
||||||
def output_colorized(self, message):
|
def output_colorized(self, message):
|
||||||
|
import ctypes
|
||||||
|
|
||||||
parts = self.ansi_esc.split(message)
|
parts = self.ansi_esc.split(message)
|
||||||
write = self.stream.write
|
write = self.stream.write
|
||||||
h = None
|
h = None
|
||||||
|
|
10
thirdparty/magic/magic.py
vendored
10
thirdparty/magic/magic.py
vendored
|
@ -16,10 +16,6 @@ Usage:
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os.path
|
import os.path
|
||||||
import ctypes
|
|
||||||
import ctypes.util
|
|
||||||
|
|
||||||
from ctypes import c_char_p, c_int, c_size_t, c_void_p
|
|
||||||
|
|
||||||
class MagicException(Exception):
|
class MagicException(Exception):
|
||||||
pass
|
pass
|
||||||
|
@ -104,6 +100,12 @@ def from_buffer(buffer, mime=False):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
libmagic = None
|
libmagic = None
|
||||||
|
|
||||||
|
import ctypes
|
||||||
|
import ctypes.util
|
||||||
|
|
||||||
|
from ctypes import c_char_p, c_int, c_size_t, c_void_p
|
||||||
|
|
||||||
# Let's try to find magic or magic1
|
# Let's try to find magic or magic1
|
||||||
dll = ctypes.util.find_library('magic') or ctypes.util.find_library('magic1')
|
dll = ctypes.util.find_library('magic') or ctypes.util.find_library('magic1')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user