-: Okay, now let's have another example 2 2
on who can people to BeEF when 3 3
they exist outside our network. 4 4
So again, we're going to have the 5 5
example, I guess, the same Windows 6 6
machine, that's in a completely 7 7
different network, and we'll see 8 8
how we can hook that machine to BeEF. 9 9
So, first of all I'm going to start BeEF. 10 10
Just one click right here and that will start BeEF for me. 11 11
And I'm going to login. 12 12
Username is BeEF and password is BeEF as well. 13 13
And we're logged in. 14 14
Now, we're going to use the same 15 15
basic hook method that we did before. 16 16
So, in that method we need to get 17 17
the script code right here, which is this. 18 18
I'm going to copy that and we did 19 19
this before so again I'm going 20 20
to do it a little bit quickly. 21 21
And we place that in our Apache web server. 22 22
So place it in an HTML page and 23 23
that was in always our Apache web home directory is 24 24
/var/www/html/ 25 25
and I'm going to open my index file. 26 26
I'm going to open it with the text editor. 27 27
And I'm going to paste this code 28 28
right here that I got from BeEF. 29 29
And the only thing that you want 30 30
to change -- all this is okay -- the 31 31
only thing that you want to change -- 32 32
as I said before -- anywhere that 33 33
we used to use our normal IP we're 34 34
going to use our external IP. 35 35
So that people when they try to 36 36
connect they'll actually be able to find our computer. 37 37
Because if we use internal IP they won't be able to see it. 38 38
So again, I'm going to use the 39 39
IP that we see on Google when 40 40
we type in "what's my IP?" 41 41
And that's it. 42 42
I'm good to go so I'm going to save this. 43 43
Quit it and now I need to enable port 3000. 44 44
Which is the port that BeEF works on. 45 45
As you can see, we can see that it uses port 3000 here. 46 46
So I need to tell the router again, 47 47
in the IP forwarding settings, 48 48
I need to tell it to forward any 49 49
request that you get on port 3000 50 50
to my [Cali?] machine which is at 192168011. 51 51
I'm going to save that and that's it. 52 52
That's saved. 53 53
Now, we're going to go to the Windows machine. 54 54
We're going to go to our website. 55 55
Which is my--basically my IP, my 56 56
external IP and we're going to go. 57 57
It's going to run index [through?] 58 58
HTML automatically because the file is called index. 59 59
So all we have to do is just put 60 60
the IP of the network that [Cali's?] connected to. 61 61
So, what we need to use is this IP address right here. 62 62
Which is 89100145189 and we should 63 63
be hooked to BeEF as soon as we browse through that IP. 64 64
So, let's see what happens. 65 65
Okay, now let's go to BeEF and 66 66
as you can see we got a Window's 67 67
machine hooked and it's using 68 68
Firefox 50 and now we can run 69 69
all the commands that BeEF allows us to run. 70 70
So, let's just throw on alert and see if it works. 71 71
And it just says, "BeEF Alert Dialog." 72 72
I'm just going to execute it just 73 73
to make sure that everything is working properly. 74 74
And, as you can see we managed 75 75
to hook, and -- a machine that 76 76
exists in a completely different network. 77 77
And again, to confirm that I'm 78 78
going to go on Google and I'm going 79 79
to look for "what's my IP?" 80 80
And as you can see the IP is completely 81 81
different to the IP that's in this machine. 82 82
So, again, all we have to do is 83 83
use the external IP address whenever 84 84
you're sending it outside the network. 85 85
Use the IP that you see when you 86 86
type in "What's my IP address?" 87 87
When you're listening on your 88 88
own machine use the local IP and 89 89
make sure you configure the router 90 90
to redirect the port that you're 91 91
listening on to the [Cali?] machine. 92 92
To the IP address -- to the private 93 93
IP address of the [Cali?] machine. 94 94
An alternative to using IP forwarding 95 95
you can set the [Cali?] machine as a DMZ host. 96 96
Now, not all routers support DMZ. 97 97
That's why I didn't show it from the start. 98 98
But if it supports it you can use it. 99 99
And what [DMs] does is it's basically 100 100
IP forwarding but it forwards all ports. 101 101
So, if you put the IP address 102 102
here, of the [Cali?] machine in 103 103
here, what the router's going 104 104
to do anytime it gets a request 105 105
for any port -- any port at all -- 106 106
it'll forward that request to 107 107
the [Cali?] machine regardless of what port it is. 108 108
So with port forwarding, you actually 109 109
select which ports you want to forward to [Cali?]. 110 110
With DMZ it will forward all the 111 111
ports to the IP that you put in here. 112 112
Now again, both of these methods 113 113
can be used to allow devices on 114 114
different networks to access your 115 115
computer so you can receive connections, 116 116
you can allow them to access a 117 117
website -- if you are hosting 118 118
a website on your web server -- 119 119
you can allow them to access fake 120 120
websites, you can allow them to 121 121
access BeEF, the hook, anything. 122 122
Anything where you are listening 123 123
on a port you can use this method 124 124
to allow people to access it if 125 125
the people exist on a completely 126 126
different network than your own network.