Control Linux servers over XMPP chat

https://web-beta.archive.org/web/20140209155007/http://oskarhane.com/make-your-raspberry-pis-and-other-servers-a-botnet-controlled-via-xmpp

http://oskarhane.com/make-your-raspberry-pis-and-other-servers-a-botnet-controlled-via-xmpp/

  1. Install node.js
  2. mkdir xmpp-bot && cd $_
    npm install optimist
    sudo npm install forever -g
    npm install simple-xmpp
    mkdir conf
    
  3. Download the three JS files from the archive.org link.
  4. Put uptime.js inside the xmpp-bot/conf folder.
  5. Run
    export NODE_PATH=`pwd`/node_modules:$NODE_PATH
  6. dir structure should look like this
    pi@pi-lights:~/xmpp-bot/node_modules $ ls
    app.js  conf  helper.js
    pi@pi-lights:~/xmpp-bot/node_modules $ ls conf
    off1.js  on1.js  uptime.js
  7. Start the server with
    node app.js -u user@server.com -p password -h 'server.com' --port 5222 --master your_real_account@server.com
  8. If it’s working, you’ll see this
    (node) sys is deprecated. Use util instead.
    off1 loaded
    on1 loaded
    uptime loaded
    Connected!

    where all of the “loaded” statements are for the various modules you’ve created.

  9. To create new modules, copy the uptime.js file, rename it to whatever you want, then change the var, holder, and module.exports line to match the new module name you’ve created. Then on the child = exec line, change the part inside the quotation marks to the command you want to run. e.g.
    child = exec("/var/www/html/rfoutlet/codesend 5575996"

  10. To start service in the background, run forever start app.js -u lights@chat.server.com -p <password> -h ‘chat.server.com’ –port 5222 –master chris@chat.server.com
Advertisements

Install node.js on Raspberry Pi

This was surprisingly difficult to find, for some reason, but it’s very simple:

wget http://node-arm.herokuapp.com/node_latest_armhf.deb 
sudo dpkg -i node_latest_armhf.deb

iptables insert rule at a specific position (prepend)

This is useful for putting rules on the input chain. Usually, you will have a DROP rule at the end of the chain, so if you want to add a new rule, it should go before DROP.

To start, figure out which line should be used for the new rule.

iptables -L -n --line-numbers

You will see output like this:

Chain INPUT (policy DROP)
num target prot opt source destination
...
22 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:993
23 DROP all -- 0.0.0.0/0 0.0.0.0/0

That means there are 23 rules in the chain.
Next, you should insert the new rule at position 23, like the following:

iptables -I INPUT 23 -p tcp --dport 5222 -j ACCEPT

That will put the new rule at 23 and push the DROP rule down to 24.
Run the first command again and you’ll now see this:

23   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:5222
24   DROP       all  --  0.0.0.0/0            0.0.0.0/0

Verifalia email validation SDK how to

Sign up for a free account and create a sub-account.

In Postman, set up a POST request to https://api.verifalia.com/v1.3/email-validations

Set the authorization to basic auth. Username is the sub-account ID, password is what you set up when creating the sub-account

Set the body to raw, change the type from Text to JSON, and set the request body as the following:

{
    entries: [
                { inputData: 'email1@gmail.com' },
		{ inputData: 'email2@gmail.com' }
    ]
}

Submit the request, and the response body will contain a line called uniqueID and a randomly generated GUID.

To get the status of the email validation you just submitted, set up a GET request to https://api.verifalia.com/v1.3/email-validations/{the GUID from before}

and set the authorization in the same way as the previous step.

Each email address will be in a separate set of curly braces, with the line “status”: “Success” (or if it wasn’t a success, whatever the error is)

Simple.

Create a free website or blog at WordPress.com.

Up ↑