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

Skip to content

Commit 956e75e

Browse files
committed
Minor adjustment to --mobile.
Bug fix to --random-agent.
1 parent 14bf6ab commit 956e75e

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

lib/core/enums.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,13 @@ class HASH:
7171

7272
# Reference: http://www.zytrax.com/tech/web/mobile_ids.html
7373
class MOBILES:
74-
IPHONE = "Apple iPhone 4;Apple-iPhone3C1/801.306"
75-
BLACKBERRY = "Blackberry 9800;Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en-US) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.246 Mobile Safari/534.1+"
76-
NEXUS = "Google Nexus One;Mozilla/5.0 (Linux; U; Android 2.2; en-US; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
74+
BLACKBERRY = "RIM Blackberry 9800 Torch;Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en-US) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.246 Mobile Safari/534.1+"
7775
GALAXY = "Samsung Galaxy S;Mozilla/5.0 (Linux; U; Android 2.2; en-US; SGH-T959D Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
78-
NOKIA = "Nokia N97;Mozilla/5.0 (SymbianOS/9.3; U; Series60/3.2 NokiaN79-1/32.001; Profile/MIDP-2.1 Configuration/CLDC-1.1) AppleWebKit/413 (KHTML, like Gecko) Safari/413"
7976
HP = "HP iPAQ 6365;Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320; HP iPAQ h6300)"
77+
HTC = "HTC Evo;Mozilla/5.0 (Linux; U; Android 2.2; en-us; Sprint APA9292KT Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
78+
IPHONE = "Apple iPhone 4;Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/531.22.7"
79+
NEXUS = "Google Nexus One;Mozilla/5.0 (Linux; U; Android 2.2; en-US; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
80+
NOKIA = "Nokia N97;Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 NokiaN97-1/10.0.012; Profile/MIDP-2.1 Configuration/CLDC-1.1; en-us) AppleWebKit/525 (KHTML, like Gecko) WicKed/7.1.12344"
8081

8182
class HTTPHEADER:
8283
ACCEPT_ENCODING = "Accept-Encoding"

lib/core/option.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,14 +1053,16 @@ def __setHTTPUserAgent():
10531053
"""
10541054

10551055
if conf.mobile:
1056-
message = "which smartphone do you want sqlmap to imitate through HTTP User-Agent header?\n"
1056+
message = "which smartphone do you want sqlmap to imitate "
1057+
message += "through HTTP User-Agent header?\n"
10571058
items = sorted(getPublicTypeMembers(MOBILES, True))
10581059

10591060
for count in xrange(len(items)):
10601061
item = items[count]
1061-
message += "[%d] %s%s\n" % (count + 1, item[:item.find(';')], " (default)" if item==MOBILES.IPHONE else "")
1062+
message += "[%d] %s%s\n" % (count + 1, item[:item.find(';')], " (default)" if item == MOBILES.IPHONE else "")
10621063

10631064
test = readInput(message.rstrip('\n'), default=items.index(MOBILES.IPHONE) + 1)
1065+
10641066
try:
10651067
item = items[int(test) - 1]
10661068
except:
@@ -1087,7 +1089,7 @@ def __setHTTPUserAgent():
10871089
if addDefaultUserAgent:
10881090
conf.httpHeaders.append(("User-Agent", __defaultHTTPUserAgent()))
10891091

1090-
elif not kb.userAgents:
1092+
else:
10911093
debugMsg = "loading random HTTP User-Agent header(s) from "
10921094
debugMsg += "file '%s'" % paths.USER_AGENTS
10931095
logger.debug(debugMsg)
@@ -1101,7 +1103,6 @@ def __setHTTPUserAgent():
11011103

11021104
conf.httpHeaders.append((HTTPHEADER.USER_AGENT, __defaultHTTPUserAgent()))
11031105

1104-
else:
11051106
count = len(kb.userAgents)
11061107

11071108
if count == 1:

0 commit comments

Comments
 (0)