抓取拼多多工作台信息
This commit is contained in:
1 parent
1745f3c397
commit
e25cc1b51e
22 files changed
+1130
-57
No files matched your search
@@ -331,6 +331,13 @@ namespace TemuKJD.BLL
|
||||
request.Headers.Add("Anti-Content", AntiContent);
|
||||
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
|
||||
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36";
|
||||
if (cookies.Contains("PASS_ID=windows") && !string.IsNullOrEmpty(shop.pddid))
|
||||
{
|
||||
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
|
||||
//request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
|
||||
//request.Headers.Add("pddid", @"zULm8bXS");
|
||||
request.Headers.Add("pddid", shop.pddid);
|
||||
}
|
||||
request.Headers.Add("ETag", rckk);
|
||||
request.Headers.Add("sec-ch-ua", @"""Not;A=Brand"";v=""99"", ""Google Chrome"";v=""139"", ""Chromium"";v=""139""");
|
||||
request.ContentType = "application/json";
|
||||
@@ -409,6 +416,13 @@ namespace TemuKJD.BLL
|
||||
request.Headers.Add("Anti-Content", AntiContent);
|
||||
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
|
||||
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36";
|
||||
if (cookies.Contains("PASS_ID=windows") && !string.IsNullOrEmpty(shop.pddid))
|
||||
{
|
||||
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
|
||||
//request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
|
||||
//request.Headers.Add("pddid", @"zULm8bXS");
|
||||
request.Headers.Add("pddid", shop.pddid);
|
||||
}
|
||||
request.Headers.Add("ETag", rckk);
|
||||
request.Headers.Add("sec-ch-ua", @"""Not;A=Brand"";v=""99"", ""Google Chrome"";v=""139"", ""Chromium"";v=""139""");
|
||||
request.Headers.Add("sec-ch-ua-mobile", @"?0");
|
||||
@@ -473,6 +487,13 @@ namespace TemuKJD.BLL
|
||||
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
|
||||
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
|
||||
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36";
|
||||
if (cookies.Contains("PASS_ID=windows") && !string.IsNullOrEmpty(shop.pddid))
|
||||
{
|
||||
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
|
||||
//request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
|
||||
//request.Headers.Add("pddid", @"zULm8bXS");
|
||||
request.Headers.Add("pddid", shop.pddid);
|
||||
}
|
||||
request.Headers.Add("ETag", rckk);
|
||||
request.Headers.Add("sec-ch-ua", @"""Not;A=Brand"";v=""99"", ""Google Chrome"";v=""139"", ""Chromium"";v=""139""");
|
||||
request.ContentType = "multipart/form-data; boundary=" + boundary;
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TemuKJD.BLL
|
||||
{
|
||||
public class MemoryReader
|
||||
{
|
||||
[DllImport("kernel32.dll")]
|
||||
public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, uint nSize, out uint lpNumberOfBytesRead);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, uint nSize, out uint lpNumberOfBytesWritten);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
public static extern bool CloseHandle(IntPtr hObject);
|
||||
|
||||
// 声明GetLastError函数
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern int GetLastError();
|
||||
|
||||
const int PROCESS_WM_READ = 0x0010;
|
||||
const int PROCESS_WM_WRITE = 0x0020;
|
||||
const int PROCESS_WM_ALL = 0x003F;
|
||||
const int PROCESS_ALL_ACCESS = 0x1F0FFF;
|
||||
|
||||
public static void ReadMemory(int nProcess, int nAddress, int nReadSize)
|
||||
{
|
||||
int processId = nProcess; // 目标进程ID
|
||||
//IntPtr hProcess = OpenProcess(PROCESS_WM_READ | PROCESS_WM_WRITE, false, processId);
|
||||
IntPtr hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, processId);
|
||||
if (hProcess == IntPtr.Zero)
|
||||
{
|
||||
int errorCode = GetLastError();
|
||||
//Console.WriteLine("Process access failed.");
|
||||
BaseForms.BaseMsgForm.ShowError("Process access failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
int endAddress = nAddress + nReadSize;
|
||||
while (nAddress < endAddress)
|
||||
{
|
||||
IntPtr address = new IntPtr(nAddress); // 目标内存地址
|
||||
byte[] buffer = new byte[1024]; // 读取数据的缓冲区
|
||||
uint bytesRead;
|
||||
if (ReadProcessMemory(hProcess, address, buffer, (uint)buffer.Length, out bytesRead))
|
||||
{
|
||||
//Console.WriteLine("Read successful.");
|
||||
string s = System.Text.Encoding.Default.GetString(buffer);
|
||||
if (s.Contains("pddidResult"))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Console.WriteLine("Read failed.");
|
||||
// 获取最后一个错误代码
|
||||
int errorCode = GetLastError();
|
||||
//Console.WriteLine("Error code: " + errorCode);
|
||||
// 将错误代码转换为异常(可选)
|
||||
Exception ex = Marshal.GetExceptionForHR(errorCode);
|
||||
//BaseForms.BaseMsgForm.ShowError(ex.Message);
|
||||
}
|
||||
nAddress += 1000;
|
||||
}
|
||||
//CloseHandle(hProcess);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -242,6 +242,7 @@ namespace TemuKJD.BLL
|
||||
shop.LoginStatus2 = BaseRegex.GetStringJson(ref shopStr, "login_status2");
|
||||
shop.OperateSubSaName = BaseRegex.GetStringJson(ref shopStr, "operate_sub_sa_name");
|
||||
shop.AddProductRemaining = BaseRegex.GetIntJson(ref shopStr, "add_product_remaining");
|
||||
shop.pddid = BaseRegex.GetStringJson(ref shopStr, "pddid");
|
||||
|
||||
if (BaseClass.MainPath == "binxixi")
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user