Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How do I change the request header parameters for adding a p

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
yazigegeda
Expert Cheater
Reputation: 0

Joined: 22 Jan 2019
Posts: 183

PostPosted: Mon Jun 17, 2024 4:54 am    Post subject: How do I change the request header parameters for adding a p Reply with quote

Code:


local url = "https://......"

local internet = getInternet()

internet.Header = "Referer: http://......"

internet.postURL( url , ... )




When I use the Capture https packet Capture tool to view the change request, the request header is not added, what is going on, help me
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25807
Location: The netherlands

PostPosted: Mon Jun 17, 2024 5:03 am    Post subject: Reply with quote

try getURL instead of postURL
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
yazigegeda
Expert Cheater
Reputation: 0

Joined: 22 Jan 2019
Posts: 183

PostPosted: Mon Jun 17, 2024 8:59 am    Post subject: Reply with quote

Dark Byte wrote:
try getURL instead of postURL



But I want to request the website needs to use post mode, so really can? I don't know the getURL way to fill in the postURL parameters
Back to top
View user's profile Send private message
yazigegeda
Expert Cheater
Reputation: 0

Joined: 22 Jan 2019
Posts: 183

PostPosted: Tue Jun 18, 2024 1:50 am    Post subject: Reply with quote

yazigegeda wrote:
Dark Byte wrote:
try getURL instead of postURL



But I want to request the website needs to use post mode, so really can? I don't know the getURL way to fill in the postURL parameters



Okay, so now I've got a hook and his tests are working :lol:


function:

Code:


local PAGE_NOACCESS , PAGE_WRITECOPY , PAGE_READONLY , PAGE_READWRITE , PAGE_EXECUTE , PAGE_EXECUTE_WRITECOPY , PAGE_EXECUTE_READ , PAGE_EXECUTE_READWRITE  = 0x01 , 0x08 , 0x2 , 0x4 , 0x10, 0x80 , 0x20 , 0x40



function NtProtectVirtualMemory(p1,p2,p3,p4,p5)   --  ,{0,p1},{0,p2}
    return executeCodeLocalEx('ntdll.NtProtectVirtualMemory',{0,p1},{0,p2},{0,p3} ,{0,p4},{0,p5})
end




function setHookRequestHeaders( p1 , p2 )


  MS_codes = createMemoryStream()
  MS_codes.Size = 255



  local MS = createMemoryStream()
  MS.Size = 0x40
  local pBaseAddress , pSize , poldpro = MS.Memory , MS.Memory+8 , MS.Memory+0x18
  WriteQwordLocal( pBaseAddress , MS_codes.Memory )
  WriteQwordLocal( pSize , 255 )
  NtProtectVirtualMemory( -1 , pBaseAddress , pSize ,  0x40 , poldpro )

  MS.destroy()


  local  HttpSendRequestA_addr = getAddress( 'wininet.HttpSendRequestA' , true )

  copyMemory( HttpSendRequestA_addr , 0xF , MS_codes.Memory , 3 )




  local ops , temp , temp2 = { 0x48 , 0xBA } , qwordToByteTable( p1 ) , dwordToByteTable( p2 )
  for i = 1 , #temp do
     table.insert( ops , temp[i] )
  end
  table.insert( ops , 0x41 )
  table.insert( ops , 0xB8 )
  for i = 1 , #temp2 do
     table.insert( ops , temp2[i] )
  end


  table.insert( ops , 0xFF )
  table.insert( ops , 0x25)
  table.insert( ops , 0x00 )
  table.insert( ops , 0x00 )
  table.insert( ops , 0x00 )
  table.insert( ops , 0x00 )

  taroffset = qwordToByteTable( HttpSendRequestA_addr + 0xF )

  for i = 1 , #taroffset do
       table.insert( ops , taroffset[i] )
  end

  WriteBytesLocal( MS_codes.Memory + 0xF , ops )


 -- print( string.format("HttpSendRequestA_addr  %X", HttpSendRequestA_addr ))


  --print( string.format("MS_codes.Memory  %X", MS_codes.Memory ))

  ops = {}

  table.insert( ops , 0xFF )
  table.insert( ops , 0x25 )
  table.insert( ops , 0x00 )
  table.insert( ops , 0x00 )
  table.insert( ops , 0x00 )
  table.insert( ops , 0x00 )

  taroffset = qwordToByteTable( MS_codes.Memory )

  for i = 1 , #taroffset do
       table.insert( ops , taroffset[i] )
  end

  WriteBytesLocal( HttpSendRequestA_addr, ops )


end

function delHookRequestHeaders()
    local ori = readBytesLocal(  MS_codes.Memory , 0xF , true)
    WriteBytesLocal( 'wininet.HttpSendRequestA' , ori )
    MS_codes.destroy()
end








demo:

Code:




local MS = createMemoryStream()
MS.Size = 0x1000
local pheaders = MS.Memory
local Headers = 'Content-Type: application/x-www-form-urlencoded\r\n'..
                'Referer: https://.....\r\n'

WriteStringLocal( pheaders , Headers )


setHookRequestHeaders( pheaders , #Headers )

dom = int.postURL( url , json... )

delHookRequestHeaders()

MS.destroy()

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites