forked from Tuhinshubhra/CMSeeK
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflex.py
More file actions
38 lines (35 loc) · 1.45 KB
/
flex.py
File metadata and controls
38 lines (35 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# This is a part of CMSeeK, check the LICENSE file for more information
# Copyright (c) 2018 - 2020 Tuhinshubhra
# FlexCMP version detection
# Rev 1
import cmseekdb.basic as cmseek
import re
def start(source, url, ua):
regex = re.findall(r'<!--.*-->', source, re.DOTALL)
if regex != []:
for r in regex:
if 'FlexCMP' in r and 'v.' in r:
tmp = r.split('\n')
for t in tmp:
if 'v.' in t:
kek = re.findall(r'v. (.*?) -', t)
if kek != []:
# coding this was actually fun idk why ;--;
version = kek[0]
cmseek.success('FlexCMP version ' + cmseek.bold + cmseek.fgreen + version + cmseek.cln + ' detected from source')
return version
else:
kurama = cmseek.getsource(url, ua)
header = kurama[2].split('\n')
regex = []
for tail in header:
if 'X-Powered-By' in tail and 'FlexCMP' in tail:
regex = re.findall(r'X-Powered-By: FlexCMP Application Server \[v\. (.*?) - ', tail)
if regex != []:
cmseek.success('FlexCMP version ' + cmseek.bold + cmseek.fgreen + regex[0] + cmseek.cln + ' detected from header')
return regex[0]
else:
cmseek.error('Version detection failed!')
return '0'