Skip to content

Commit

Permalink
Allow custom webpage addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
xfangfang committed May 24, 2024
1 parent 8866b72 commit 695b3d6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pppwn --interface en0 --fw 1100 --stage1 "stage1.bin" --stage2 "stage2.bin" --ti
- `-bs` `--buffer-size`: PCAP buffer size in bytes, less than 100 indicates default value (usually 2MB) (default: `0`)
- `-a` `--auto-retry`: automatically retry when fails or timeout
- `-nw` `--no-wait-padi`: don't wait one more [PADI](https://en.wikipedia.org/wiki/Point-to-Point_Protocol_over_Ethernet#Client_to_server:_Initiation_(PADI)) before starting the exploit
- `--web`: use the web interface
- `--url`: the url of the web interface (default: `0.0.0.0:7796`)

Supplement:

Expand Down
3 changes: 3 additions & 0 deletions include/web.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class WebPage {

~WebPage();

void setUrl(const std::string &url);

void run();

void stop();
Expand All @@ -55,4 +57,5 @@ class WebPage {
CustomBuf buf;
std::streambuf *stdbuf;
std::string historyLog;
std::string url = "http://0.0.0.0:7796";
};
5 changes: 4 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ int main(int argc, char *argv[]) {
using namespace clipp;
std::cout << "[+] PPPwn++ - PlayStation 4 PPPoE RCE by theflow" << std::endl;
std::string interface, stage1 = "stage1/stage1.bin", stage2 = "stage2/stage2.bin";
std::string web_url = "0.0.0.0:7796";
int fw = 1100;
int timeout = 0;
int wait_after_pin = 1;
Expand All @@ -140,7 +141,8 @@ int main(int argc, char *argv[]) {
option("-bs", "--buffer-size") & integer("bytes", buffer_size), \
"automatically retry when fails or timeout" % option("-a", "--auto-retry").set(retry), \
"don't wait one more PADI before starting" % option("-nw", "--no-wait-padi").set(no_wait_padi), \
"start a web page" % option("--web").set(web_page)
"start a web page" % option("--web").set(web_page), \
"url" % option("--url") & value("url", web_url)
) | \
"list interfaces" % command("list").call(listInterfaces)
);
Expand Down Expand Up @@ -183,6 +185,7 @@ int main(int argc, char *argv[]) {

if (web_page) {
web = std::make_shared<WebPage>(exploit);
web->setUrl(web_url);
web->run();
return 0;
}
Expand Down
12 changes: 8 additions & 4 deletions src/web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,20 @@ WebPage::~WebPage() {
std::cout.rdbuf(stdbuf);
}

void WebPage::setUrl(const std::string &url) {
this->url = "http://" + url;
}

void WebPage::run() {
mg_log_set(MG_LL_ERROR);
struct mg_mgr mgr{};
mg_mgr_init(&mgr);
const char *url = "http://0.0.0.0:8000";

if (mg_http_listen(&mgr, url, ev_handler, this) == nullptr) {
printf("[-] Cannot listen on %s\n", url);
if (mg_http_listen(&mgr, url.c_str(), ev_handler, this) == nullptr) {
printf("[-] Cannot listen on %s\n", url.c_str());
return;
} else {
printf("[+] Starting web server on %s\n", url);
printf("[+] Starting web server on %s\n", url.c_str());
}
running = true;
while (running) {
Expand Down

0 comments on commit 695b3d6

Please sign in to comment.