-
Notifications
You must be signed in to change notification settings - Fork 36
Targeted Portals
A Targeted Portal is more of a dynamic portal that uses user defined rules to route a client to a specific landing page.
Creating
- Open the Evil Portal module on your Pineapples web interface.
- In the root of the "Work Bench" section, In the drop down menu select "Targeted"
- Type the name of this portal (example: "targeted_portal").
- Click "Create New Portal" to create the portal on the internal storage of the Pineapple (/root/portals/{name}), or if applicable, click "Create On SD" to create the portal on the SD card inserted in your Pineapple (/sd/portals/{name}).
To edit your portal click on the name of your portal in the list of portals in the work bench. You'll see the work bench UI change to a list of files in your portal. Click "Edit" next to the file you want to edit and you will see the source code there. Be sure to click save when you are done making changes.
- index.php
- This file contains the routing logic and should not be edited directly unless you know what you are doing! (This differs from Basic Portals)
- default.php
- This is the default landing page that clients will land on if there are no rules that match them. Consider this to be functionally the same as index.php for basic portals.
- MyPortal.php
- Just like for basic portals, this is where the authorization logic happens. There are other methods you can call from here as well to do things like send notifications to the web UI or write logs to the portals log file.
- helper.php
- Contains php helper functions that are intended to be used on the portal pages (default.php or other pages you create)
These are the rules that the portal will use to determine what the page the client should see. Currently you can create explicit or implicit rules for a clients mac address, associated SSID, hostname, or useragent. These rules can either be explicitly defined or implicitly defined using a regular expression. These rules are evaluated linearly using an 'or' meaning that if a client matches a rule for 'Mac' and 'SSID' but the 'Mac' rule was evaluated first, the client will be sent to destination page defined for the 'Mac' rule. By default the rule evaluation order is: "mac", "ssid", "hostname", "useragent".
- Open the Evil Portal module on your pineapple.
- Click on the name of the targeted portal you are wanting to edit rules for.
- In the top right corner, click "Target Rule Editor". You should see the Rule Editor modal open.
- Under the category of rule you are going to add ("MAC", "SSID", "HOSTNAME", or "USERAGENT") select "Add Rule" next to "Exact" (explicit) or "Regex" (implicit).
- Enter the value for "Rule Key" and "Destination"
- "Rule Key" is the expected value that you want a client to match. This is either the explicit value or implicit regex pattern
- "Destination" is the landing page the client will be routed to if they match the given rule. You will need to create this page!
- Click save when you are done.
- Open the Evil Portal module on your pineapple.
- Click on the name of the targeted portal you are wanting to add a destination to.
- In The top right corner, click "New File". You should see the file creation modal open.
- Name the file the same thing you entered as "Destination" for your rule in "Creating/Editing Rules" section above.
- Write the code here for the destination page. Its recommended to just copy the contents of "default.php" to serve as a base line.
- Click save when you are done.
Currently there is no way to do this in the UI and it requires you to edit a file over SSH or with a module such as Cabinet.
- (Via SSH or Cabinet) navigate to /{root or sd}/portals/{portal_name}
- Edit the {portal_name}.ep file in your editor of choice
- Edit the order of elements in the "targeted_rules" => "rule_order" array.
- Save when you are done.