forked from Tuhinshubhra/CMSeeK
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyabb.py
More file actions
35 lines (31 loc) · 1.27 KB
/
yabb.py
File metadata and controls
35 lines (31 loc) · 1.27 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
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# This is a part of CMSeeK, check the LICENSE file for more information
# Copyright (c) 2018 - 2020 Tuhinshubhra
# YaBB version detection
# Rev 1
import cmseekdb.basic as cmseek
import re
def start(source):
regex = re.search(r'Powered by(.*?)YaBB (\d.*?)( |</a>)', source, re.DOTALL)
if regex != None:
try:
version = regex.group(2)
cmseek.success('YaBB version ' + cmseek.bold + cmseek.fgreen + version + cmseek.cln + ' detected')
return version
except Exception as e:
regex = re.findall(r'<!-- YaBB (\d.*?) ', source)
if regex != []:
if regex[0] != '' and regex[0] != ' ':
version = regex[0]
cmseek.success('YaBB version ' + cmseek.bold + cmseek.fgreen + version + cmseek.cln + ' detected')
return version
else:
regex = re.findall(r'<!-- YaBB (\d.*?) ', source)
if regex != []:
if regex[0] != '' and regex[0] != ' ':
version = regex[0]
cmseek.success('YaBB version ' + cmseek.bold + cmseek.fgreen + version + cmseek.cln + ' detected')
return version
cmseek.error('Version detection failed!')
return '0'