Online Sequencer Make music online
  • Sequences
  • Members
  • Import MIDI
  • Forum

Existing user? Sign In Create account
Login at Online Sequencer Forums

Online Sequencer Forums › Off Topic › General Discussion
« Previous 1 … 34 35 36 37 38 … 42 Next »

Pointless Program: BMOS v0.1 (CURRENT v1.3)

Thread tools
Pointless Program: BMOS v0.1 (CURRENT v1.3)
Frank Offline
Grey Hat Script Kiddie who can Compose Music
392 Posts:
 
#5
07-13-2018, 08:17 PM (This post was last modified: 07-13-2018, 08:18 PM by Frank.)
(07-13-2018, 06:51 PM)Void Wrote: This surprised me when I saw it. That's really cool. Good job Frank!


I myself am doing some very basic stuff with request's (like always, shenanigans with my bots.) like I am trying to figure out how to keep a login session alive long enough to be able to create a thread or respond to posts here on the forums with node-fetch because It's much neater and shorter code to write. 

If you'd like to help me, please tell me what's wrong here if you're willing to look into my issue?

Code:
const { URLSearchParams } = require('url');
const fetch = require('node-fetch');
const delay = timeout => new Promise(resolve => { setTimeout(resolve, timeout); });
const fs = require('fs');

let mysubject = "Thread by : VoidBot"
let mymessage = "Testing content. bla bla bla";

let myusername = "Void"
let mypass = "mypass"

const generate_posthash = (length, chars) => {

 let idk = '';
 while(length--) idk += chars[(Math.random() * chars.length) | 0];
 return idk;
};

(async () => {

    for(let i = 0; i < 1; i++){

        const posthash = generate_posthash(32, 'abcdefghijklmnopstuv0123456789');

        let parameters2 = new URLSearchParams();

        parameters2.append('username', myusername);
        parameters2.append('password', mypass);
        parameters2.append('action', "do_login");
        parameters2.append('url', "");


       let parameters = new URLSearchParams();
        parameters.append('subject', mysubject);
        parameters.append('message', mymessage);
        parameters.append('my_post_key', "e64cc8d83f82219bbe9fb85f7668092a");
        parameters.append('submit', "Post Thread");
        parameters.append('previewpost', "Preview Post");
        parameters.append('savedraft', "Save as Draft");
        parameters.append('action', "do_newthread");
        parameters.append('posthash', posthash);
        parameters.append('attachmentaid', "");
        parameters.append('attachmentact', "");
        parameters.append('quoted_ids', "");
        parameters.append('tid', "0");

        //let login = await fetch('https://onlinesequencer.net/ajax/login.php?user=Void&pass=mypass');


        let session = await fetch('https://onlinesequencer.net/forum/member.php', {
           'method' : 'post',
           'body' : parameters2,
           'credentials' : 'include'
           //'headers' : { 'cookie' : cookie }
        });

        //let cookie = session.headers.get('set-cookie');
        //console.log(session.headers.get('set-cookie'));

        let request = await fetch('https://onlinesequencer.net/forum/newthread.php?fid=8&processed=1', {
           'method' : 'post',
           'body' : parameters,
           //'headers' : { 'cookie' : cookie }
           'credentials' : 'include'
        });

        let result = await request.text();

        fs.writeFileSync('output.html', result);

        console.log(result);
        console.log(request.status + " " + request.statusText);

        //await delay(100); //If we want to run a delay.

    };

})();

So the first part works, sending a post request with the form-data to get myself logged in on the forums, but even before the program is able to print the fs.writeFileSync it has already logged me out and thus I don't see myself logged in on the source code. Postman, an application I use to test these forms does show me logged in in the preview mode so I know it works. This log in is actually so fast that even myBB is unable to update the 'last logged in' time on my forum profile page lol. I need a way to keep the session alive even at the second part, the thread part. Cookie should be stored at the 'credentials : include' but it just doesn't want to work. Any ideas?

Code:
const fetch = require('node-fetch');
const FormData = require('form-data');

const form = new FormData();
form.append('username', "Void");
form.append('password', "pass");
form.append('action', "do_login");
form.append('url', "");

fetch('https://onlinesequencer.net/forum/member.php', { method: 'POST', body: form, headers: form.getHeaders(), credentials: 'same-origin' })
   .then(res => res.text())
   .then(body => console.log(body));
^ simplified BUT WONT WORK!? I don't understand.

I wish I could help you, but I am not familiar with requireJS nor network requests. However, I can tell you have caught the Frank Variable Names Disease™ of which I am fond:
Code:
const generate_posthash = (length, chars) => {

 let idk = '';
 while(length--) idk += chars[(Math.random() * chars.length) | 0];
 return idk;
};


Kim Wrote: + https://js-game.glitch.me + Doesnt take peopel serious if their has badly speling gramer puntuatin
Reply

Messages In This Thread
Pointless Program: BMOS v0.1 (CURRENT v1.3) - by Frank - 07-13-2018, 09:54 AM
RE: Pointless Program: BMOS v0.1 - by Jacob_ - 07-13-2018, 05:53 PM
RE: Pointless Program: BMOS v0.1 - by Frank - 07-13-2018, 06:16 PM
RE: Pointless Program: BMOS v0.1 - by Frank - 07-13-2018, 08:49 PM
RE: Pointless Program: BMOS v0.1 - by Frank - 07-14-2018, 06:57 AM
RE: Pointless Program: BMOS v0.1 - by Frank - 07-23-2018, 08:52 AM
RE: Pointless Program: BMOS v0.1 - by zapmek - 07-13-2018, 06:51 PM
RE: Pointless Program: BMOS v0.1 - by Frank - 07-13-2018, 08:17 PM
RE: Pointless Program: BMOS v0.1 (CURRENT v1.2) - by Frank - 12-07-2018, 03:39 PM



Users browsing this thread:   1 Guest(s)


  •  Return to Top
  •  Contact Us
  •   Home
  •  Lite mode
© Rush Crafted with ❤ by iAndrew
Powered By MyBB, © 2002-2022 MyBB Group.
Linear Mode
Threaded Mode
View a Printable Version
Subscribe to this thread
Add Poll to this thread
Send thread to a friend