Follow us on Twitter!
Ideas are far more powerful than guns.
Thursday, April 24, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 28
Guests Online: 22
Members Online: 6

Registered Members: 82895
Newest Member: kevy90
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

XMLHttpRequest() or GM_XMLHttpRequest help

elmiguel
Member



Posts: 161
Location: Your Computer
Joined: 12.12.07
Rank:
God
Posted on 29-07-09 13:30
OK I am having issues with both these functions and cannot seem to know why it is not working.

XMLHttpRequest():
Code
 var req = new XMLHttpRequest(); 
 req.open('GET', 'https://developer.mozilla.org/En/Using_XMLHttpRequest', false);   
 req.send(null); 
 if(req.status == 200){ 
   alert(req.responseText);
 }





GM_XMLHttpRequest():
Code
GM_xmlhttpRequest({
   method: "POST",
   url: "http://www.site.com",
   headers: {"Content-Type": "WHAT IS THE MIME TYPE TO POST JUST TO A URL NOT A FORM!"},
   data: "key" + encodeURI('stringToEncode')
  }
});




I have been messing around with both GET and POST methods with both of functions (not in the same code of course). For some reason I get back null or nothing at all, and others I get the error feedback I put in. Does anyone have a working code for me to review and see what I am doing wrong?. I have looked over a lot of material on the web and all seems to be correct, but I can not perform this simple action.

Thanks in advance.

-elmiguel


The philosophy of one century is the common sense of the next. -Fortune Cookie

I would like to thank a few friends that I have made here that helped me and deserve to be mentioned:
System_Meltdown, Futility, nvrlivenvrdie, Mastergamer, TrueHacker, S1L3NTKn1GhT, Reelix, ynori7, Demons Halo, kryptor

www.hellboundhackers.org/sig/r/24963.png

www.hellboundhackers.org/sig/hbh2.png
<script>alert('XSS');</script>
Author

RE: XMLHttpRequest() or GM_XMLHttpRequest help

elmiguel
Member



Posts: 161
Location: Your Computer
Joined: 12.12.07
Rank:
God
Posted on 29-07-09 13:38
Figured it out, it was my incorrect use of the headers and MIME Type

ex:

Code

GM_xmlhttpRequest({
    method: 'GET',
    url: 'http://www.google.com',
    headers: {
        'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
        'Accept': 'application/xhtml+xml',
    },
    onload: function(responseDetails) {
        alert('Request for Google feed returned ' + responseDetails.status +
              ' ' + responseDetails.statusText + '\n\n' +
              'Feed data:\n' + responseDetails.responseText);
    }
});






The philosophy of one century is the common sense of the next. -Fortune Cookie

I would like to thank a few friends that I have made here that helped me and deserve to be mentioned:
System_Meltdown, Futility, nvrlivenvrdie, Mastergamer, TrueHacker, S1L3NTKn1GhT, Reelix, ynori7, Demons Halo, kryptor

www.hellboundhackers.org/sig/r/24963.png

www.hellboundhackers.org/sig/hbh2.png
<script>alert('XSS');</script>
Author

RE: XMLHttpRequest() or GM_XMLHttpRequest help

elmiguel
Member



Posts: 161
Location: Your Computer
Joined: 12.12.07
Rank:
God
Posted on 29-07-09 13:49
OK, maybe not, works on google but when I try to request a page here it doesn't work:


Code

var elements = ''; // whether null, blank or empty data is not being stored here.
GM_xmlhttpRequest({
    method: 'GET',
    url: 'http://www.hellboundhackers.org/challenges/timed/timed8/index.php',
    headers: {
        'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
        'Accept': 'text/plain',
    },
    onload: function(responseDetails) {
       elements = (responseDetails.responseText);// gets the data.
    }
});
alert (elements); // if tried to store the data is lost.





[EDIT]: Changed MIME Type to: text/plain. It does get the data, but for some reason it will not store the data into a variable


The philosophy of one century is the common sense of the next. -Fortune Cookie

I would like to thank a few friends that I have made here that helped me and deserve to be mentioned:
System_Meltdown, Futility, nvrlivenvrdie, Mastergamer, TrueHacker, S1L3NTKn1GhT, Reelix, ynori7, Demons Halo, kryptor

www.hellboundhackers.org/sig/r/24963.png

www.hellboundhackers.org/sig/hbh2.png


Edited by elmiguel on 29-07-09 13:58
<script>alert('XSS');</script>
Author

RE: XMLHttpRequest() or GM_XMLHttpRequest help

SySTeM
Member

Your avatar

Posts: 1524
Location: England, UK
Joined: 27.07.05
Rank:
HBH Guru
Posted on 29-07-09 19:37
How does GM_xmlhttpRequest handle cookies?


img138.imageshack.us/img138/6527/sig2ak1.jpg
www.hellboundhackers.org/sig/r/2783.png

http://www.elites0ft.com/
Author

RE: XMLHttpRequest() or GM_XMLHttpRequest help

spyware
Member



Posts: 4192
Location:
Joined: 14.04.07
Rank:
God
Warn Level: 90
Posted on 29-07-09 19:46
You need to send your HBH cookies with the request.



img507.imageshack.us/img507/3580/spynewsig3il1.png
"The chowner of property." - Zeph
[small]
Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.
- Carl Sagan
[center]�Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?� - Ebert[/ce
Author

RE: XMLHttpRequest() or GM_XMLHttpRequest help

elmiguel
Member



Posts: 161
Location: Your Computer
Joined: 12.12.07
Rank:
God
Posted on 29-07-09 20:31
Code

function post(url, data) {
      GM_xmlhttpRequest({
        method: "POST",
        url: url,
        headers:{'Content-type':'application/x-www-form-urlencoded',       
                 'Cookie' : 'PHPSESSID=<DATA>;fusion_user=<DATA>'},
        data: "ans=" +encodeURI(data),
      });
    }
post('http://www.hellboundhackers.org/challenges/timed/timed8/index.php', a});








I am sending the Cookies but its not working


The philosophy of one century is the common sense of the next. -Fortune Cookie

I would like to thank a few friends that I have made here that helped me and deserve to be mentioned:
System_Meltdown, Futility, nvrlivenvrdie, Mastergamer, TrueHacker, S1L3NTKn1GhT, Reelix, ynori7, Demons Halo, kryptor

www.hellboundhackers.org/sig/r/24963.png

www.hellboundhackers.org/sig/hbh2.png
<script>alert('XSS');</script>
Author

RE: XMLHttpRequest() or GM_XMLHttpRequest help


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 29-07-09 23:17
If it doesn't automatically add it, you are going to have to add "Content-Length:" to that header.