Skip to content

Commit 53b2dcb

Browse files
author
Jose Pino
committed
Option to update Trape and verify recent version
1 parent 324526a commit 53b2dcb

6 files changed

Lines changed: 35 additions & 28 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
23
trape (stable) v2.0
34
========
45

@@ -107,6 +108,8 @@ optional arguments:
107108
-n, --ngrok Insert your ngrok Authtoken
108109
-ic INJC, --injectcode INJC
109110
Insert your custom REST API path
111+
-ud UPDATE, --update UPDATE
112+
Update trape to the latest version
110113
```
111114

112115
**--url** In this option you add the URL you use to clone Live, which works as a decoy.
@@ -123,6 +126,8 @@ optional arguments:
123126

124127
**--version** You can see the version number of trape.
125128

129+
**--update** Option especially to upgrade to the latest version of **trape**.
130+
126131
**--help** It is used to see all the above options, from the executable.
127132

128133

core/trape.py

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import sys
2121
import os
2222
from core.utils import utils
23-
from subprocess import call
23+
import subprocess
2424
import requests
2525
import hashlib, binascii
2626
from threading import Timer
@@ -30,7 +30,7 @@
3030
class Trape(object):
3131
def __init__(self, stat = 0):
3232
self.name_trape = "Trape"
33-
self.version = 2.0
33+
self.version = "2.0"
3434
self.stats_path = utils.generateToken(7)
3535
self.home_path = utils.generateToken(18)
3636
self.logout_path = utils.generateToken(6)
@@ -72,13 +72,14 @@ def __init__(self, stat = 0):
7272
if self.googl == '':
7373
self.googl = 'AIzaSyDHMDTOGo9L1OBl5vRxOVM6vpXOXVp5jCc'
7474

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)
7676
parser.add_argument('-u', '--url', dest='url', help='Put the web page url to clone')
7777
parser.add_argument('-p', '--port', dest='port', help='Insert your port')
7878
parser.add_argument('-ak', '--accesskey', dest='accesskey', help='Insert your custom key access')
7979
parser.add_argument('-l', '--local', dest='local', help='Insert your home file')
8080
parser.add_argument('-n', '--ngrok', dest='ngrok', help='Insert your ngrok Authtoken', action='store_true')
8181
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')
8283

8384
options = parser.parse_args()
8485

@@ -149,10 +150,33 @@ def __init__(self, stat = 0):
149150
if (options.accesskey):
150151
self.stats_key = options.accesskey
151152

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+
152162
# Design principal of the header of trape
153163
def header(self):
154164
if self.stat == 1:
165+
# Principal header of tool
155166
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
156180
utils.Go(utils.Color['white'] + "\t" + utils.Color['whiteBold'] + "LOCAL INFORMATION" + utils.Text['end'])
157181
utils.Go("\t" + "-------------------")
158182
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):
218242
def main(self):
219243
import core.sockets
220244

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")
240245

241246
# Create config file
242247
def trape_config(self):

core/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def banner():
6969
utils.Go("\t" + "-----------------------------------------------")
7070
utils.Go(utils.Color['green'] + "\t" + "People tracker on internet for OSINT research " + utils.Color['white'] + "|=-" + utils.Color['white'])
7171
utils.Go("\t" + "-----------------------------------------------")
72-
utils.Go("\t" + "| v" + utils.Color['redBold'] + "2.0" + utils.Color['white'] + " |")
72+
utils.Go("\t" + "| " + utils.Color['white'] + "v" + utils.Color['redBold'] + "2.0" + utils.Color['white'] + " |")
7373
utils.Go("\t" + "--------" + "\n")
7474

7575
# Loader with console cleaning and OS checking

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ python-socketio
1212
six
1313
Werkzeug
1414
eventlet
15-
urllib2
16-
requests
15+
requests

trape.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@
7272
# check OS
7373
trackPeople.loadCheck()
7474

75-
# check Version
76-
trackPeople.checkVersion()
77-
7875
# Request root home to run <trape> with all permissions
7976
trackPeople.rootConnection()
8077

version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version: 2.0

0 commit comments

Comments
 (0)