|
20 | 20 | import sys |
21 | 21 | import os |
22 | 22 | from core.utils import utils |
23 | | -from subprocess import call |
| 23 | +import subprocess |
24 | 24 | import requests |
25 | 25 | import hashlib, binascii |
26 | 26 | from threading import Timer |
|
30 | 30 | class Trape(object): |
31 | 31 | def __init__(self, stat = 0): |
32 | 32 | self.name_trape = "Trape" |
33 | | - self.version = 2.0 |
| 33 | + self.version = "2.0" |
34 | 34 | self.stats_path = utils.generateToken(7) |
35 | 35 | self.home_path = utils.generateToken(18) |
36 | 36 | self.logout_path = utils.generateToken(6) |
@@ -72,13 +72,14 @@ def __init__(self, stat = 0): |
72 | 72 | if self.googl == '': |
73 | 73 | self.googl = 'AIzaSyDHMDTOGo9L1OBl5vRxOVM6vpXOXVp5jCc' |
74 | 74 |
|
75 | | - parser = argparse.ArgumentParser("python trape.py -u <<Url>> -p <<Port>>", version="1.0.0") |
| 75 | + parser = argparse.ArgumentParser("python trape.py -u <<Url>> -p <<Port>>", version=self.version) |
76 | 76 | parser.add_argument('-u', '--url', dest='url', help='Put the web page url to clone') |
77 | 77 | parser.add_argument('-p', '--port', dest='port', help='Insert your port') |
78 | 78 | parser.add_argument('-ak', '--accesskey', dest='accesskey', help='Insert your custom key access') |
79 | 79 | parser.add_argument('-l', '--local', dest='local', help='Insert your home file') |
80 | 80 | parser.add_argument('-n', '--ngrok', dest='ngrok', help='Insert your ngrok Authtoken', action='store_true') |
81 | 81 | parser.add_argument('-ic', '--injectcode', dest='injc', help='Insert your custom REST API path') |
| 82 | + parser.add_argument('-ud', '--update', dest='update', help='Update trape to the latest version') |
82 | 83 |
|
83 | 84 | options = parser.parse_args() |
84 | 85 |
|
@@ -149,10 +150,33 @@ def __init__(self, stat = 0): |
149 | 150 | if (options.accesskey): |
150 | 151 | self.stats_key = options.accesskey |
151 | 152 |
|
| 153 | + # Check current updates |
| 154 | + if (options.update): |
| 155 | + utils.Go("\033[H\033[J") |
| 156 | + utils.Go("Updating..." + " " + utils.Color['blue'] + "trape" + utils.Color['white'] + "..." + "\n") |
| 157 | + subprocess.check_output(["git", "reset", "--hard", "origin/master"]) |
| 158 | + subprocess.check_output(["git", "pull"]) |
| 159 | + utils.Go("Trape Updated... Please execute again...") |
| 160 | + sys.exit(0) |
| 161 | + |
152 | 162 | # Design principal of the header of trape |
153 | 163 | def header(self): |
154 | 164 | if self.stat == 1: |
| 165 | + # Principal header of tool |
155 | 166 | utils.banner() |
| 167 | + |
| 168 | + # Update verification |
| 169 | + changeLog = requests.get("https://raw.githubusercontent.com/thewhiteh4t/pwnedOrNot/master/version.txt", timeout = 5) |
| 170 | + changeLog = changeLog.text.split(" ")[1] |
| 171 | + changeLog = changeLog.strip() |
| 172 | + if changeLog != self.version: |
| 173 | + utils.Go(utils.Color['white'] + "\t" + utils.Color['yellowBold'] + "@" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['whiteBold'] + " " + "UPDATES:" + " " + utils.Color['yellowBold'] + "NEW VERSION IS AVAILABLE: " + utils.Color['white'] + "v" + utils.Color['redBold'] + changeLog + utils.Color['white'] + " " + "(install changes)") |
| 174 | + utils.Go("") |
| 175 | + else: |
| 176 | + utils.Go(utils.Color['white'] + "\t" + utils.Color['yellowBold'] + "@" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['whiteBold'] + " " + "UPDATES:" + " " + utils.Color['greenBold'] + "RUNNING RECENT VERSION" + utils.Color['white']) |
| 177 | + utils.Go("") |
| 178 | + |
| 179 | + # Local information vars |
156 | 180 | utils.Go(utils.Color['white'] + "\t" + utils.Color['whiteBold'] + "LOCAL INFORMATION" + utils.Text['end']) |
157 | 181 | utils.Go("\t" + "-------------------") |
158 | 182 | utils.Go(utils.Color['white'] + "\t" + utils.Color['green'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Lure for the users: " + utils.Color['blue'] + 'http://' + self.localIp + ':' + str(self.app_port) + '/' + self.victim_path) |
@@ -218,25 +242,6 @@ def loadCheck(self): |
218 | 242 | def main(self): |
219 | 243 | import core.sockets |
220 | 244 |
|
221 | | - # Check current upgrades |
222 | | - def checkVersion(self): |
223 | | - pass |
224 | | - |
225 | | - # Check current upgrades |
226 | | - def trape_upgrade(self): |
227 | | - result = call(["git", "pull"]) |
228 | | - if result == 0: |
229 | | - changeLog = json.load(open('changelog.json')) |
230 | | - |
231 | | - item = changeLog[0] |
232 | | - for key, value in item.iteritems(): |
233 | | - utils.Go(utils.Color['white'] + "[" + utils.Color['blueBold'] + "*" + utils.Color['white'] + "]" + utils.Color['white'] + str(key) + ': ' + str(value)) |
234 | | - time.sleep(5) |
235 | | - utils.Go("Please press enter to continue and then restart Trape") |
236 | | - raw_input() |
237 | | - sys.exit(0) |
238 | | - else: |
239 | | - utils.Go("Update unavailable, please check your connection") |
240 | 245 |
|
241 | 246 | # Create config file |
242 | 247 | def trape_config(self): |
|
0 commit comments