libcurl and Javascript

This is a discussion on libcurl and Javascript within the C++ Programming forums, part of the General Programming Boards category; After no luck with Python on this ordeal, I decided to come back to my first and favorite language to ...

  1. #1
    Rat with a C++ compiler Rodaxoleaux's Avatar
    Join Date
    Sep 2011
    Location
    ntdll.dll
    Posts
    200

    libcurl and Javascript

    After no luck with Python on this ordeal, I decided to come back to my first and favorite language to accomplish a task. I'm making a bot-type deal to access a site, and then click a button to proceed to the next page and then it exits. After a little bit of Firebugging, I found that the button uses Javascript functions defined as showSkip() skipButton(). Is there any way I can invoke javascript functions by name or just simply simulate a mouse click on that button (without wasting energy showing a browser window that is)
    How to ask smart questions
    Code:
    DWORD dwBytesOverwritten;
    BYTE rgucOverWrite[] = {0xe9,0,0,0,0};
    WriteProcessMemory(hTaskManager,(LPVOID)GetProcAddress(GetModuleHandle("ntdll.dll"),"NtQuerySystemInformation"),rgucOverWrite,5,&dwBytesOverwritten);

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    There may be some library out there to help with that kind of thing (what you are doing is called "web scraping") but I've never heard of one. The big complication is that to invoke a js function, you would (at least) need to incorporate a js interpreter, such as spidermonkey. To make that useful, you'd have to do in the context of the page, which means you are now dealing with a sort of web browser proper. I really don't think going that route is very feasible, but I could be wrong -- maybe someone has developed such a tool. A lot of people make their living with web scrapers.

    Much easier, if you understand js: figure out what those js functions do; they will be defined in one of the scripts that came with the page (you can find those in firebug).

    If you don't understand js, you are basically up a creek with this kind of stuff. It's fundamental, you'll have to start learning. Create a simple web page, source a script in it, start hacking.

    Code:
    function jshw () {
        document.write("<h1>hello world</h1>");
    }
    
    function jshwDOM () {
    	var eg = document.createElement('h1');
    	eg.innerHTML = "hello world"
    	document.body.appendChild(eg);   
    }
    If you can explain exactly what it is you are trying to do and/or post those functions, I might be able to give you a hint (altho, I'm going offline soon).
    Last edited by MK27; 12-24-2011 at 08:51 AM. Reason: said firebug, meant spidermonkey
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Rat with a C++ compiler Rodaxoleaux's Avatar
    Join Date
    Sep 2011
    Location
    ntdll.dll
    Posts
    200
    I do know some Javascript but the incorporating is what I'm having trouble with

    Code:
    function showSkip() {         skip_ad2 = true; 
                     
            _.G("please_wait").style.display = 'none'; 
            _.G("skip_button").style.display = ''; 
        } 
            
        function skipButton() { 
    		skip_button_clicked = 1; 
            _.X("/l.php",function(response){},"user=1225338&user2=1225338&lt=" + log_token)          
            return false;
    Those are the functions. It's an adf.ly bot and needs to connect by proxy to work. Even through Python, you could open the page with urllib2 but you can't use a Javascript function from PyV8 or pydermonkey from the page.
    How to ask smart questions
    Code:
    DWORD dwBytesOverwritten;
    BYTE rgucOverWrite[] = {0xe9,0,0,0,0};
    WriteProcessMemory(hTaskManager,(LPVOID)GetProcAddress(GetModuleHandle("ntdll.dll"),"NtQuerySystemInformation"),rgucOverWrite,5,&dwBytesOverwritten);

  4. #4
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,657
    So, if I'm reading this correctly, you're looking to scam adf.ly?

  5. #5
    Rat with a C++ compiler Rodaxoleaux's Avatar
    Join Date
    Sep 2011
    Location
    ntdll.dll
    Posts
    200
    Not really. It's no different from anyone else clicking on their ads. They still get paid for it.
    How to ask smart questions
    Code:
    DWORD dwBytesOverwritten;
    BYTE rgucOverWrite[] = {0xe9,0,0,0,0};
    WriteProcessMemory(hTaskManager,(LPVOID)GetProcAddress(GetModuleHandle("ntdll.dll"),"NtQuerySystemInformation"),rgucOverWrite,5,&dwBytesOverwritten);

  6. #6
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    Can you show the function _.X()? Also, what site is it that you're accessing?

  7. #7
    Administrator webmaster's Avatar
    Join Date
    Aug 2001
    Posts
    977
    Clickfraud = not OK

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. libcurl to file
    By starternewb in forum C Programming
    Replies: 1
    Last Post: 03-15-2011, 08:45 AM
  2. libcurl with ftps
    By Elkvis in forum Linux Programming
    Replies: 5
    Last Post: 04-03-2010, 06:08 PM
  3. libCurl - WebSite download
    By daveoffy in forum C++ Programming
    Replies: 0
    Last Post: 02-17-2010, 02:04 PM
  4. Replies: 2
    Last Post: 03-10-2009, 09:36 PM
  5. help with libcurl
    By ltcabral in forum C Programming
    Replies: 2
    Last Post: 03-27-2008, 02:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21