Skip to content

Commit

Permalink
removed support to Rest API controller temporally
Browse files Browse the repository at this point in the history
  • Loading branch information
mh4x0f committed May 13, 2021
1 parent 6368a00 commit 1d02e4a
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 65 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file.
### Deprecated

### Removed
- removed support to Rest API controller temporally

### Fixed
- fixed cli error when resquest restAPI plugins and proxies
Expand Down
6 changes: 3 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ requests>=2.18.4
beautifulsoup4>=4.9.1
black
coverage==5.1
jwt>=1.0.0
Flask-RESTful==0.3.7
Werkzeug==1.0.1
# jwt>=1.0.0
# Flask-RESTful==0.3.7
# Werkzeug==1.0.1

6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ Flask==1.1.1
requests>=2.18.4
beautifulsoup4>=4.9.1
asn1crypto>=1.0.0
jwt>=1.0.0
Flask-RESTful==0.3.7
Werkzeug==1.0.1
#jwt>=1.0.0
#Flask-RESTful==0.3.7
#Werkzeug==1.0.1
95 changes: 48 additions & 47 deletions wifipumpkin3/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
import wifipumpkin3.core.utility.constants as C
from os import getuid

from wifipumpkin3.core.servers.rest.application import RestControllerAPI
# disable RestAPI
# from wifipumpkin3.core.servers.rest.application import RestControllerAPI
import threading


Expand All @@ -37,27 +38,27 @@ def parser_args_func(parse_args, config):
info=True,
)
)
if parse_args.restmode:
if not (parse_args.password):
print(
display_messages(
"{} \n rest mode require a valid password.".format(
setcolor("password invalid", color="red")
),
info=True,
)
)
exit(0)

set_nocolors()
config.set_one("ap_mode", "restapi", True)
config.set("rest_api_settings", "PASSWORD", parse_args.password)
config.set("rest_api_settings", "USERNAME", parse_args.username)
config.set("rest_api_settings", "port", parse_args.restport)
server_restapi = RestControllerAPI("wp3API", config)
thead = threading.Thread(target=server_restapi.run)
thead.setDaemon(True)
thead.start()
# if parse_args.restmode:
# if not (parse_args.password):
# print(
# display_messages(
# "{} \n rest mode require a valid password.".format(
# setcolor("password invalid", color="red")
# ),
# info=True,
# )
# )
# exit(0)

# set_nocolors()
# config.set_one("ap_mode", "restapi", True)
# config.set("rest_api_settings", "PASSWORD", parse_args.password)
# config.set("rest_api_settings", "USERNAME", parse_args.username)
# config.set("rest_api_settings", "port", parse_args.restport)
# server_restapi = RestControllerAPI("wp3API", config)
# thead = threading.Thread(target=server_restapi.run)
# thead.setDaemon(True)
# thead.start()


def wp3_header():
Expand Down Expand Up @@ -115,31 +116,31 @@ def main():
action="store_true",
default=False,
)
parser.add_argument(
"--rest",
dest="restmode",
help="Run the Wp3 RESTful API.",
action="store_true",
default=False,
)
parser.add_argument(
"--restport",
dest="restport",
help="Port to run the Wp3 RESTful API on. default is 1337",
default=1337,
)
parser.add_argument(
"--username",
dest="username",
help="Start the RESTful API with the specified username instead of pulling from wp3.db",
default="wp3admin",
)
parser.add_argument(
"--password",
dest="password",
help="Start the RESTful API with the specified password instead of pulling from wp3.db",
default=None,
)
# parser.add_argument(
# "--rest",
# dest="restmode",
# help="Run the Wp3 RESTful API.",
# action="store_true",
# default=False,
# )
# parser.add_argument(
# "--restport",
# dest="restport",
# help="Port to run the Wp3 RESTful API on. default is 1337",
# default=1337,
# )
# parser.add_argument(
# "--username",
# dest="username",
# help="Start the RESTful API with the specified username instead of pulling from wp3.db",
# default="wp3admin",
# )
# parser.add_argument(
# "--password",
# dest="password",
# help="Start the RESTful API with the specified password instead of pulling from wp3.db",
# default=None,
# )
parser.add_argument(
"-v",
"--version",
Expand Down
27 changes: 15 additions & 12 deletions wifipumpkin3/core/common/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,19 +220,22 @@ def do_start(self, args):
self.threads["RogueAP"].extend(self.proxy_controller.ActiveReactor)
self.threads["RogueAP"].extend(self.mitm_controller.ActiveReactor)

if not self.parse_args.restmode:
self.wireless_controller.ActiveReactor.start()
self.wireless_controller.ActiveReactor.signalApIsRuning.connect(
self.signalHostApdProcessIsRunning
)
return

self.wireless_controller.ActiveReactor.start()
for thread in self.threads["RogueAP"]:
if thread is not None:
QtCore.QThread.sleep(1)
if not (isinstance(thread, list)):
thread.start()
self.wireless_controller.ActiveReactor.signalApIsRuning.connect(self.signalHostApdProcessIsRunning)

# if not self.parse_args.restmode:
# self.wireless_controller.ActiveReactor.start()
# self.wireless_controller.ActiveReactor.signalApIsRuning.connect(
# self.signalHostApdProcessIsRunning
# )
# return

# self.wireless_controller.ActiveReactor.start()
# for thread in self.threads["RogueAP"]:
# if thread is not None:
# QtCore.QThread.sleep(1)
# if not (isinstance(thread, list)):
# thread.start()

def signalHostApdProcessIsRunning(self, status):
if status:
Expand Down

0 comments on commit 1d02e4a

Please sign in to comment.