add custom user-agent

This commit is contained in:
Jan Rude
2020-03-19 08:38:34 +01:00
parent 2bb78a9783
commit e528640e8a

View File

@@ -40,12 +40,15 @@ class Typo3:
self.__extensions = [] self.__extensions = []
def run(self): def run(self):
database = os.path.join(self.__path, 'lib', 'typo3scan.db') if (args.user_agent):
conn = sqlite3.connect(database) user_agent = args.user_agent
c = conn.cursor() else:
c.execute('SELECT * FROM UserAgents ORDER BY RANDOM() LIMIT 1;') database = os.path.join(self.__path, 'lib', 'typo3scan.db')
user_agent = c.fetchone()[0] conn = sqlite3.connect(database)
c.close() c = conn.cursor()
c.execute('SELECT * FROM UserAgents ORDER BY RANDOM() LIMIT 1;')
user_agent = c.fetchone()[0]
c.close()
config = {'threads': args.threads, 'timeout': args.timeout, 'cookie': args.cookie, 'auth': args.auth, 'User-Agent': user_agent} config = {'threads': args.threads, 'timeout': args.timeout, 'cookie': args.cookie, 'auth': args.auth, 'User-Agent': user_agent}
json.dump(config, open(os.path.join(self.__path, 'lib', 'config.json'), 'w')) json.dump(config, open(os.path.join(self.__path, 'lib', 'config.json'), 'w'))
try: try:
@@ -139,7 +142,6 @@ Options:
You dont need to specify this arguments, but you may want to You dont need to specify this arguments, but you may want to
--vuln Check for extensions with known vulnerabilities only. --vuln Check for extensions with known vulnerabilities only.
Default: all
--timeout TIMEOUT Request Timeout. --timeout TIMEOUT Request Timeout.
Default: 10 seconds Default: 10 seconds
@@ -147,6 +149,8 @@ Options:
--auth USER:PASS Username and Password for HTTP Basic Authorization. --auth USER:PASS Username and Password for HTTP Basic Authorization.
--cookie NAME=VALUE Can be used for authenticiation based on cookies. --cookie NAME=VALUE Can be used for authenticiation based on cookies.
--agent USER-AGENT Set custom User-Agent for requests.
--threads THREADS The number of threads to use for enumerating extensions. --threads THREADS The number of threads to use for enumerating extensions.
Default: 5 Default: 5
@@ -167,6 +171,7 @@ Options:
parser.add_argument('--threads', dest='threads', type=int, default=5) parser.add_argument('--threads', dest='threads', type=int, default=5)
parser.add_argument('--auth', dest='auth', type=str, default='') parser.add_argument('--auth', dest='auth', type=str, default='')
parser.add_argument('--cookie', dest='cookie', type=str, default='') parser.add_argument('--cookie', dest='cookie', type=str, default='')
parser.add_argument('--agent', dest='user_agent', type=str, default='')
parser.add_argument('--timeout', dest='timeout', type=int, default=10) parser.add_argument('--timeout', dest='timeout', type=int, default=10)
help.add_argument( '-h', '--help', action='store_true') help.add_argument( '-h', '--help', action='store_true')
args = parser.parse_args() args = parser.parse_args()