GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Avoid libmagic traceback on Windows. · bookjoy/sqlmap@aefa7ef

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • contrib
      • magic.py
    • core
      • common.py
  • sqlmap.conf
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/contrib/magic.py‎

Copy file name to clipboardExpand all lines: lib/contrib/magic.py
+47-46Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -98,68 +98,69 @@ def from_buffer(buffer, mime=False):
9898

9999

100100

101+
try:
102+
libmagic = ctypes.CDLL(ctypes.util.find_library('magic'))
101103

102-
libmagic = ctypes.CDLL(ctypes.util.find_library('magic'))
104+
magic_t = ctypes.c_void_p
103105

104-
magic_t = ctypes.c_void_p
106+
def errorcheck(result, func, args):
107+
err = magic_error(args[0])
108+
if err is not None:
109+
raise MagicException(err)
110+
else:
111+
return result
105112

106-
def errorcheck(result, func, args):
107-
err = magic_error(args[0])
108-
if err is not None:
109-
raise MagicException(err)
110-
else:
111-
return result
112-
113-
magic_open = libmagic.magic_open
114-
magic_open.restype = magic_t
115-
magic_open.argtypes = [c_int]
116-
117-
magic_close = libmagic.magic_close
118-
magic_close.restype = None
119-
magic_close.argtypes = [magic_t]
120-
magic_close.errcheck = errorcheck
113+
magic_open = libmagic.magic_open
114+
magic_open.restype = magic_t
115+
magic_open.argtypes = [c_int]
121116

122-
magic_error = libmagic.magic_error
123-
magic_error.restype = c_char_p
124-
magic_error.argtypes = [magic_t]
117+
magic_close = libmagic.magic_close
118+
magic_close.restype = None
119+
magic_close.argtypes = [magic_t]
120+
magic_close.errcheck = errorcheck
125121

126-
magic_errno = libmagic.magic_errno
127-
magic_errno.restype = c_int
128-
magic_errno.argtypes = [magic_t]
122+
magic_error = libmagic.magic_error
123+
magic_error.restype = c_char_p
124+
magic_error.argtypes = [magic_t]
129125

130-
magic_file = libmagic.magic_file
131-
magic_file.restype = c_char_p
132-
magic_file.argtypes = [magic_t, c_char_p]
133-
magic_file.errcheck = errorcheck
126+
magic_errno = libmagic.magic_errno
127+
magic_errno.restype = c_int
128+
magic_errno.argtypes = [magic_t]
134129

130+
magic_file = libmagic.magic_file
131+
magic_file.restype = c_char_p
132+
magic_file.argtypes = [magic_t, c_char_p]
133+
magic_file.errcheck = errorcheck
135134

136-
_magic_buffer = libmagic.magic_buffer
137-
_magic_buffer.restype = c_char_p
138-
_magic_buffer.argtypes = [magic_t, c_void_p, c_size_t]
139-
_magic_buffer.errcheck = errorcheck
140135

136+
_magic_buffer = libmagic.magic_buffer
137+
_magic_buffer.restype = c_char_p
138+
_magic_buffer.argtypes = [magic_t, c_void_p, c_size_t]
139+
_magic_buffer.errcheck = errorcheck
141140

142-
def magic_buffer(cookie, buf):
143-
return _magic_buffer(cookie, buf, len(buf))
144141

142+
def magic_buffer(cookie, buf):
143+
return _magic_buffer(cookie, buf, len(buf))
145144

146-
magic_load = libmagic.magic_load
147-
magic_load.restype = c_int
148-
magic_load.argtypes = [magic_t, c_char_p]
149-
magic_load.errcheck = errorcheck
150145

151-
magic_setflags = libmagic.magic_setflags
152-
magic_setflags.restype = c_int
153-
magic_setflags.argtypes = [magic_t, c_int]
146+
magic_load = libmagic.magic_load
147+
magic_load.restype = c_int
148+
magic_load.argtypes = [magic_t, c_char_p]
149+
magic_load.errcheck = errorcheck
154150

155-
magic_check = libmagic.magic_check
156-
magic_check.restype = c_int
157-
magic_check.argtypes = [magic_t, c_char_p]
151+
magic_setflags = libmagic.magic_setflags
152+
magic_setflags.restype = c_int
153+
magic_setflags.argtypes = [magic_t, c_int]
158154

159-
magic_compile = libmagic.magic_compile
160-
magic_compile.restype = c_int
161-
magic_compile.argtypes = [magic_t, c_char_p]
155+
magic_check = libmagic.magic_check
156+
magic_check.restype = c_int
157+
magic_check.argtypes = [magic_t, c_char_p]
162158

159+
magic_compile = libmagic.magic_compile
160+
magic_compile.restype = c_int
161+
magic_compile.argtypes = [magic_t, c_char_p]
162+
except:
163+
pass
163164

164165

165166
MAGIC_NONE = 0x000000 # No flags
Collapse file

‎lib/core/common.py‎

Copy file name to clipboardExpand all lines: lib/core/common.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,10 @@ def getRemoteIP():
742742

743743

744744
def getFileType(filePath):
745-
magicFileType = magic.from_file(filePath)
745+
try:
746+
magicFileType = magic.from_file(filePath)
747+
except:
748+
return "unknown"
746749

747750
if "ASCII" in magicFileType or "text" in magicFileType:
748751
return "text"
Collapse file

‎sqlmap.conf‎

Copy file name to clipboardExpand all lines: sqlmap.conf
+1-15Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,7 @@
22

33
# Target URL.
44
# Example: http://192.168.1.121/sqlmap/mysql/get_int.php?id=1&cat=2
5-
# Windows Server 2003 Service Pack 2 virtual machine
6-
#url = http://192.168.62.154/sqlmap/mysql/iis/get_int.asp?id=1
7-
#url = http://192.168.62.154/sqlmap/mysql/iis/get_int.aspx?id=1
8-
#url = http://192.168.62.154/sqlmap/mysql/iis/get_int_51.aspx?id=1
9-
#url = http://192.168.62.154/sqlmap/pgsql/iis/get_int.asp?id=1
10-
#url = http://192.168.62.154/sqlmap/pgsql/iis/get_int.aspx?id=1
11-
#url = http://192.168.62.154/sqlmap/mssql/iis/get_str.asp?name=luther
12-
url = http://192.168.62.154/sqlmap/mssql/iis/get_str2.asp?name=luther
13-
#url = http://192.168.62.154/sqlmap/mssql/iis/get_str2_user.asp?name=luther
14-
# Ubuntu 8.10 (Intrepid Ibex) virtual machine
15-
#url = http://192.168.62.146/sqlmap/mysql/get_int.php?id=1
16-
#url = http://192.168.62.146/sqlmap/mssql/get_int.php?id=1
17-
#url = http://192.168.62.146/sqlmap/oracle/get_int.php?id=1
18-
#url = http://10.0.0.58/sqlmap/pgsql/get_int.php?id=1
19-
#url = http://192.168.62.146/sqlmap/pgsql/get_int_partialunion.php?id=1
5+
url =
206

217
# Parse targets from Burp or WebScarab logs
228
# Valid: Burp proxy (http://portswigger.net/suite/) requests log file path

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.