Get you livebox router IP Adres

Here is bash on alias for get IP adress of your livebox router. (tested on Ubuntu GNU/Linux)

alias livebox-ip='tmp=`mktemp`;curl -u admin:<your password> --silent --url http://192.168.1.1/internetservices.html -o $tmp; grep -E "var v_Adrs_IP[^=]*=" $tmp | cut -d"\"" -f2 ; rm $tmp'

You must have installed curl. Note that you must change your livebox password.

, ,

Leave a comment

Program do ściągania plików z przeklej.pl

Poniżej podaje skrypt w ruby do ściągania plików z przekleja


#!/usr/bin/ruby
require "net/http"
require "uri"
require "getoptlong"

class FileToBigException < Exception
end

class FileDeletedException < Exception
end

class LinkErrorException < Exception
end

def file(name)
  File.open(name) {|file|
    return file.read()
  }
end

def host(url)
  url =~ /http:\/\/([^\/]*)\//
  return $1
end

def trail_slash(url)
  if url =~ /http:\/\/[^\/]*$/
    url += '/'
  end
  return url
end

class GetOpt
  def initialize(*options)
    opts = GetoptLong.new(*options)
    @opts = {}
    opts.each{|opt,arg|
      @opts[opt] = arg
    }
  end
  def [](key)
    return @opts[key]
  end
end

def get(url, cookies=nil, referer=nil)
  url = URI.parse(trail_slash(url))
  http = Net::HTTP.new(url.host)
  headers = {}
  if cookies
    headers['Cookie'] = cookies
  end
  if referer
    headers['Referer'] = referer
  end
  res = http.get(url.path, headers)
  return res.body
end

def wget(url, limit=false, filename=nil, referer=nil, cookies=nil)
  params = '-c -U Mozilla --keep-session-cookies' 
  if limit
    params += " --limit-rate=#{limit}" 
  end
  if filename
    params += " -O \"#{filename}\""
  end
  if cookies
    params += " --load-cookies=\"#{cookies}\""
  end
  if referer
    params += " --referer=\"#{referer}\""
  end
  `wget #{params} "#{url}"`
end

def przeklej_login_cookies(user, passwd)
  url = URI.parse('http://www.przeklej.pl/loguj')
  data = {
    'login[login]'=> user,
    'login[pass]' => passwd}
  res = Net::HTTP.post_form(url, data)
  return res.response['set-cookie']
end

def przeklej_logout()
  url = 'http://przeklej.pl/wyloguj'
  return get(url)
end

def fix_filename(filename)
  filename = filename.gsub(/ +/, ' ')
  filename = filename.gsub(' .', '.')
  filename = title(filename)
  return filename
end

def download(url, limit=false, user=nil, passwd=nil)
  referer = url
  if user and passwd
    cookies = przeklej_login_cookies(user, passwd)
    cookies_filename = 'download_przeklej_cookies.txt'
    File.open(cookies_filename, 'w') {|file|
      file.puts cookies
    }
    page = get(url, cookies)
  else
    cookies_filename = nil
    page = get(url)
  end
  if page =~ /Plik zosta/
    raise FileDeletedException
  end
  #if not loged
  if not page =~ /Wyloguj/
    loged = false
    if page =~ /pny <strong>abonament<\/strong>/
      raise FileToBigException
    end
  else
    loged = true
  end
  if page =~ /<p class="download-popup-abonament-button-box">[^<]*<a href="([^"]*)">/
    uri = $1
  elsif page =~ /<a class="download" href="([^"]*)"/
    uri = $1
  end
  if page =~ /B..dny parametr w linku/
    raise LinkErrorException
  end
  if page =~ /title="Pobierz plik">([^<]*)/
    filename = fix_filename($1)
    if loged
      #send request (simulate XHR)
      page =~ /var myhref = "([^"]*)"/
      check = get("http://www.przeklej.pl#{$1}#{(rand*1000).floor}", cookies, url)
      if check =~ /"return_code":1/
        raise TransferLimitException
      end
      res = response("http://www.przeklej.pl#{uri}", cookies, url)
      if not res['Location'] =~ /http:\/\//
        url = "http://www.przeklej.pl#{res['Location']}"
      else
        url = res['Location']
      end
      wget(url, limit, filename, referer)
    else
      wget("http://www.przeklej.pl#{uri}", limit, filename, referer)
    end
  end
  if user and passwd
    przeklej_logout
  end
end

opts = GetOpt.new(
                  ["--limit-rate", "-r", GetoptLong::REQUIRED_ARGUMENT],
                  ["--user", "-u", GetoptLong::REQUIRED_ARGUMENT],
                  ["--help", "-h", GetoptLong::NO_ARGUMENT],
                  ["--passwd", "-p", GetoptLong::REQUIRED_ARGUMENT])


limit = opts['--limit-rate']
user = opts['--user']
passwd = opts['--passwd']

if ARGV.length != 0 and host(ARGV[0]) == 'www.przeklej.pl'
  begin
    przeklej(url, limit)
  rescue FileToBigException
    if user and passwd
      begin
        przeklej(url, limit, user, passwd)
      rescue TransferLimitException
        puts "You can't download that file (buy more transfer)"
      end
    else
      puts "File Too Big"
    end
  rescue FileDeleted
    puts "File Deleted"
  rescue LinkError  rescue FileToBigException
    if user and passwd
      begin
        przeklej(url, limit, user, passwd)
      rescue TransferLimitException
        puts "You can't download that file (buy more transfer)"
      end
    else
      puts "File Too Big"
    end
  rescue FileDeletedException
    puts "File Deleted"
  rescue LinkErrorException
    puts "Link Error"
  end
end

Można go użyć tak:

download.rb <adres url>
download.rb -f <plik z adresami>

Jeśli mamy konto na przekleju to możemy użyć hasła i nazwy użytkownika do pobierani plików większych niż 50MB

download.rb -u <urzytkownik> -p <hasło> -f <plik z adresami>

Możesz także zwolnić zciąganie plików:

download.rb -r 128k <adres>

Aby użyć tego skryptu musisz mieć zainstalowany program wet. Skrypt możesz pobrać stąd.

,

Leave a comment

File Hosting Downloader Project

I’ve create my first github project Downloader. It’s a Ruby script for download files from file hosting services. You can download files from 4shared, rapidshare, przeklej, filesonic and wrzuta. You can download it from github or from here.

You can use it:


download.rb <url>
or
download.rb -f <file with urls>

If you download files from rapidshare and you have Orange livebox, you can provide livebox possword for reconnection (change dynamic ADSL IP)


download.rb -l <livebox password> -f <filename>

If you download files from przeklej you can provide you user name and password if you want to download file larger than 50MB


download.rb -u <user> -p <password> -f <filename>

, , , , , ,

Leave a comment

Change you IP with livebox

If you have livebox wireless router you could easily change you dynamic IP. It is handy if you download files from rapidshare. Here is the python code. It was tested on polish livebox. You could download code from here.

#!/usr/bin/python
import base64
import  urllib2
import urllib

def send(data, host, passwd):
    "send request to livebox SubmitInternetService."
    action = 'http://%s/SubmitInternetService' % host
    req = urllib2.Request(action, urllib.urlencode(data))
    passwd = base64.b64encode('%s:%s' % ('admin', passwd))
    req.add_header('Authorization',  'Basic %s' % passwd)
    request = urllib2.urlopen(req)
    return request.read()

def disconnect(host, passwd):
    "disconnect from internet."
    data = {'ACTION_DISCONNECT': 'Roz&#322;&#261;cz'}
    return send(data, host, passwd)

def connect(host, passwd):
    "connect to the internet."
    data = {'ACTION_CONNECT': 'Po&#322;&#261;cz'}
    return send(data, host, passwd)

You can use this functions like this.

if __name__ == '__main__':
    from sys import argv
    opts, rest = getopt(argv[1:], 'p:h:')
    opts = dict(opts)
    if len(rest) == 0:
        passwd = opts.get('-p', 'admin')
        host = opts.get('-h', '192.168.1.1')
        try:
            disconnect(host, passwd)
            connect(host, passwd)
        except urllib2.HTTPError, e:
            if e.code == 401:
                print 'wrong password'
            else:
                print 'Error: %s' % e.args
            exit(1)
        except urllib2.URLError, e:
            print 'Error: %s' % ' '.join(e.args)
        else:
            print "password successfuly changed"

You could use this progam like this:

change_ip.py -h <your host> -p <your password>

Default host is 192.168.1.1 and default password is admin

Programming Blogs - Blog Catalog Blog Directory

, ,

Leave a comment

Video about Metasploit Framework

  1. Metasploit Intro [Irongeek]:
    download AVI | presentation PDF
  2. Metasploit Scanning and Pivoting [Pwrcycle]
    download AVI | presentation PDF
  3. Metasploit Fuzzing and Exploit Development [Nullthreat]
    download AVI | presentation + examples
  4. Meterpreter and Post Exploitation + Metasploit Express demo [Purehate]
    download AVI | presentation ZIP
  5. Social Engineering Toolkit [ReL1K]
    download AVI
  6. More Encoding Fun, Fasttrack and Closing [ReL1K]
    download AVI


Blog services

, ,

Leave a comment

Md5 bruteforce in Ruby

Here is the code for bruteforce md5 hash. It check only small letters.

require 'digest/md5'
def crack(hash, max_length)
  for i in 1..max_length
    for word in ('a'*i..'z'*i)
      if Digest::MD5.new(word) == hash
        return word
      end
    end
  end
end
puts crack(ARGV[0], 5)

, ,

Leave a comment

Dowload files from rapidshare

Here are function writen in Python for downloading files from Rapidshare. Unfortunetly you must wait couple of seconds, you can’t skip this because it seems that counting is on server side too.

from urllib2 import urlopen, Request
from urllib import urlencode
import os
import re
import time
import base64

class DownloadLimitException(Exception):
    def __init__(self, *arg):
        Exception.__init__(self, *arg)

def download(url):
    page = urlopen(url).read()
    action_url_regex = '<form id="[^"]*" action="([^"]*)"'
    s_url = re.search(action_url_regex, page)
    if s_url:
        url = s_url.group(1)
        data = urlencode({'dl.start': 'Free'})
        request = Request(url, data)
        page = urlopen(request).read()
        action_url_regex = '<form name="[^"]*" action="([^"]*)"'
        c_regex = 'var c=([0-9]*);'
        limit_regex = 'You have reached the download limit for free-users'
        if re.match(limit_regex, page):
            raise DownloadLimitException(limit_regex)
        s_url = re.search(action_url_regex, page)
        s_c = re.search(c_regex, page)
        if s_url and s_c:
            url = s_url.group(1)
            c = int(s_c.group(1))
            print "wait %i seconds" % c
            time.sleep(c)
            os.system('wget "%s"' % url)

You could use this function like this. Notice that you must have wget installed on your system.

def main():
    from sys import argv
    if len(argv) == 2:
        try:
            download(argv[1])
        except DownloadLimitException,
            print "limit reached"

if __name__ == '__main__':
    main()

, , ,

Leave a comment

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: