Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 877d46e

Browse files
committed
Fixes #2234
1 parent 7e69cc1 commit 877d46e

5 files changed

Lines changed: 102 additions & 3 deletions

File tree

lib/core/option.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,6 +1794,8 @@ def _dirtyPatches():
17941794

17951795
httplib._MAXLINE = 1 * 1024 * 1024 # to accept overly long result lines (e.g. SQLi results in HTTP header responses)
17961796

1797+
from thirdparty.wininetpton import win_inet_pton
1798+
17971799
def _purgeOutput():
17981800
"""
17991801
Safely removes (purges) output directory.

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.enums import OS
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.0.10.43"
22+
VERSION = "1.0.10.44"
2323
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2424
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2525
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

thirdparty/wininetpton/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright Ryan Vennell
4+
#
5+
# This software released into the public domain. Anyone is free to copy,
6+
# modify, publish, use, compile, sell, or distribute this software,
7+
# either in source code form or as a compiled binary, for any purpose,
8+
# commercial or non-commercial, and by any means.
9+
10+
pass
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env python
2+
# This software released into the public domain. Anyone is free to copy,
3+
# modify, publish, use, compile, sell, or distribute this software,
4+
# either in source code form or as a compiled binary, for any purpose,
5+
# commercial or non-commercial, and by any means.
6+
7+
import socket
8+
import ctypes
9+
import os
10+
11+
12+
class sockaddr(ctypes.Structure):
13+
_fields_ = [("sa_family", ctypes.c_short),
14+
("__pad1", ctypes.c_ushort),
15+
("ipv4_addr", ctypes.c_byte * 4),
16+
("ipv6_addr", ctypes.c_byte * 16),
17+
("__pad2", ctypes.c_ulong)]
18+
19+
if hasattr(ctypes, 'windll'):
20+
WSAStringToAddressA = ctypes.windll.ws2_32.WSAStringToAddressA
21+
WSAAddressToStringA = ctypes.windll.ws2_32.WSAAddressToStringA
22+
else:
23+
def not_windows():
24+
raise SystemError(
25+
"Invalid platform. ctypes.windll must be available."
26+
)
27+
WSAStringToAddressA = not_windows
28+
WSAAddressToStringA = not_windows
29+
30+
31+
def inet_pton(address_family, ip_string):
32+
addr = sockaddr()
33+
addr.sa_family = address_family
34+
addr_size = ctypes.c_int(ctypes.sizeof(addr))
35+
36+
if WSAStringToAddressA(
37+
ip_string,
38+
address_family,
39+
None,
40+
ctypes.byref(addr),
41+
ctypes.byref(addr_size)
42+
) != 0:
43+
raise socket.error(ctypes.FormatError())
44+
45+
if address_family == socket.AF_INET:
46+
return ctypes.string_at(addr.ipv4_addr, 4)
47+
if address_family == socket.AF_INET6:
48+
return ctypes.string_at(addr.ipv6_addr, 16)
49+
50+
raise socket.error('unknown address family')
51+
52+
53+
def inet_ntop(address_family, packed_ip):
54+
addr = sockaddr()
55+
addr.sa_family = address_family
56+
addr_size = ctypes.c_int(ctypes.sizeof(addr))
57+
ip_string = ctypes.create_string_buffer(128)
58+
ip_string_size = ctypes.c_int(ctypes.sizeof(ip_string))
59+
60+
if address_family == socket.AF_INET:
61+
if len(packed_ip) != ctypes.sizeof(addr.ipv4_addr):
62+
raise socket.error('packed IP wrong length for inet_ntoa')
63+
ctypes.memmove(addr.ipv4_addr, packed_ip, 4)
64+
elif address_family == socket.AF_INET6:
65+
if len(packed_ip) != ctypes.sizeof(addr.ipv6_addr):
66+
raise socket.error('packed IP wrong length for inet_ntoa')
67+
ctypes.memmove(addr.ipv6_addr, packed_ip, 16)
68+
else:
69+
raise socket.error('unknown address family')
70+
71+
if WSAAddressToStringA(
72+
ctypes.byref(addr),
73+
addr_size,
74+
None,
75+
ip_string,
76+
ctypes.byref(ip_string_size)
77+
) != 0:
78+
raise socket.error(ctypes.FormatError())
79+
80+
return ip_string[:ip_string_size.value - 1]
81+
82+
# Adding our two functions to the socket library
83+
if os.name == 'nt':
84+
socket.inet_pton = inet_pton
85+
socket.inet_ntop = inet_ntop

txt/checksum.md5

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ e4aec2b11c1ad6039d0c3dbbfbc5eb1a lib/core/exception.py
3939
cc9c82cfffd8ee9b25ba3af6284f057e lib/core/__init__.py
4040
91c514013daa796e2cdd940389354eac lib/core/log.py
4141
468ca9a68a5a40a1cb8395602083ba32 lib/core/optiondict.py
42-
bf17e2bc2dc356105a159d8c093bd952 lib/core/option.py
42+
6d3e00fe69fd2fe9a794cae18b48b56c lib/core/option.py
4343
7af487340c138f7b5dbd443161cbb428 lib/core/profiling.py
4444
e60456db5380840a586654344003d4e6 lib/core/readlineng.py
4545
5ef56abb8671c2ca6ceecb208258e360 lib/core/replication.py
4646
99a2b496b9d5b546b335653ca801153f lib/core/revision.py
4747
7c15dd2777af4dac2c89cab6df17462e lib/core/session.py
48-
469c00ca02a5d91ca058cfc54cfa7e94 lib/core/settings.py
48+
c2d650ebf3d2c270c8ba082bf1ae249b lib/core/settings.py
4949
7af83e4f18cab6dff5e67840eb65be80 lib/core/shell.py
5050
23657cd7d924e3c6d225719865855827 lib/core/subprocessng.py
5151
c3ace7874a536d801f308cf1fd03df99 lib/core/target.py
@@ -352,6 +352,8 @@ d41d8cd98f00b204e9800998ecf8427e thirdparty/socks/__init__.py
352352
a2f0ee74ccc895150f310ef8d680edca thirdparty/socks/socks.py
353353
d41d8cd98f00b204e9800998ecf8427e thirdparty/termcolor/__init__.py
354354
ea649aae139d8551af513769dd913dbf thirdparty/termcolor/termcolor.py
355+
bf55909ad163b58236e44b86e8441b26 thirdparty/wininetpton/__init__.py
356+
a44e7cf30f2189b2fbdb635b310cdc0c thirdparty/wininetpton/win_inet_pton.py
355357
855372c870a23d46683f8aa39d75f6a1 thirdparty/xdot/__init__.py
356358
593473084228b63a12318d812e50f1e2 thirdparty/xdot/xdot.py
357359
08c706478fad0acba049d0e32cbb6411 udf/mysql/linux/32/lib_mysqludf_sys.so_

0 commit comments

Comments
 (0)