Jump to content

How do i download and install a specific module using the rest api ?


Go to solution Solved by dark_pyrro,

Recommended Posts

I am trying to use the rest api to automate the setup of my pineapple VII and want to install the evilportal module.

I have read the guide here : https://hak5.github.io/mk7-docs/docs/rest/modules/modules/ but find the method description for downloading and installing a module hard to understand..

It just says:

Install remote module use the PUT /api/modules/install

Request Body
{ BODY }

Response

If successful, RETURNS:

{ RESPONSE }

I cant figure out how to send that CURL line .. !?

Here is what I am doing so far but cant get the correct syntax:

CURL="/usr/bin/curl"

# GET REST_API_TOKEN
TOKEN=$(${CURL} -s -X POST http://172.16.42.1:1471/api/login -d '{"username": "root", "password": "Ihateplaintextpasswordsincommands"}'|cut -d '"' -f 4)

# Download and install the evilportal module using the Token i just got from the last command
${CURL} -s -X PUT http://172.16.42.1:1471/api/modules/install -H "Authorization: Bearer ${TOKEN}" -d '{"name":"evilportal"}'

It returns this error:     {"error":"json: cannot unmarshal array into Go value of type models.RemoteModule"}

# This works and will return a list of modules i can download:
${CURL} -s -X GET http://172.16.42.1:1471/api/modules/available -H "Authorization: Bearer ${TOKEN}"

[{"name":"MACInfo","title":"MAC Info","author":"KoalaV2","version":"1.1.1","description":"Lookup information on MAC Adresses","size":11405,"download_link":"https://downloads.hak5.org/api/devices/wifipineapplemk7/modules/MACInfo/download"},{"name":"hcxdumptool","title":"Hcxdumptool","author":"lorenzoPrimi","version":"1.0","description":"Small tool to capture packets from wlan devices.","size":14696,"download_link":"https://downloads.hak5.org/api/devices/wifipineapplemk7/modules/hcxdumptool/download"},{"name":"DNSspoof","title":"DNSspoof","author":"90N45","version":"1.0.2","description":"Spoof DNS records","size":11237,"download_link":"https://downloads.hak5.org/api/devices/wifipineapplemk7/modules/DNSspoof/download"},{"name":"httpeek","title":"HTTPeek","author":"newbi3","version":"1.2.1","description":"View plaintext HTTP traffic, such as cookies and images.","size":13077,"download_link":"https://downloads.hak5.org/api/devices/wifipineapplemk7/modules/httpeek/download"},{"name":"cabinet","title":"Cabinet","author":"newbi3","version":"1.2.1","description":"A simple browser based file manager for the WiFi Pineapple.","size":11452,"download_link":"https://downloads.hak5.org/api/devices/wifipineapplemk7/modules/cabinet/download"},{"name":"evilportal","title":"Evil Portal","author":"newbi3","version":"1.5.3","description":"An evil captive portal for the WiFi Pineapple.","size":35812,"download_link":"https://downloads.hak5.org/api/devices/wifipineapplemk7/modules/evilportal/download"},{"name":"DenyIP","title":"DenyIP","author":"90N45","version":"1.0.0","description":"Declare IP addresses and refuse their traffic","size":9056,"download_link":"https://downloads.hak5.org/api/devices/wifipineapplemk7/modules/DenyIP/download"},{"name":"locate","title":"Locate","author":"KoalaV2","version":"1.1.1","description":"Geolocate IP addresses and domain names over HTTPS via ipapi.","size":8822,"download_link":"https://downloads.hak5.org/api/devices/wifipineapplemk7/modules/locate/download"},{"name":"wpasec","title":"WpaSec","author":"makcanca","version":"1.0","description":"Provides UI to submit WPA handshakes to https://wpa-sec.stanev.org","size":9587,"download_link":"https://downloads.hak5.org/api/devices/wifipineapplemk7/modules/wpasec/download"},{"name":"wigle","title":"WiGLE","author":"90N45","version":"1.0.2","description":"Information gathering of APs with the WiGLE.net database","size":15160,"download_link":"https://downloads.hak5.org/api/devices/wifipineapplemk7/modules/wigle/download"},{"name":"mtr","title":"MTR","author":"KoalaV2","version":"1.1.1","description":"Traceroute and ping a host.","size":17496,"download_link":"https://downloads.hak5.org/api/devices/wifipineapplemk7/modules/mtr/download"},{"name":"tcpdump","title":"TCPDump","author":"newbi3","version":"1.3.1","description":"Web GUI for the tcpdump packet analyzer tool.","size":15522,"download_link":"https://downloads.hak5.org/api/devices/wifipineapplemk7/modules/tcpdump/download"},{"name":"mdk4","title":"MDK4","author":"newbi3","version":"1.3.2","description":"Web GUI for the MDK4 wireless testing tool.","size":29669,"download_link":"https://downloads.hak5.org/api/devices/wifipineapplemk7/modules/mdk4/download"},{"name":"nmap","title":"Nmap","author":"newbi3","version":"1.3.1","description":"Web GUI for Nmap, the popular network mapping tool.","size":20094,"download_link":"https://downloads.hak5.org/api/devices/wifipineapplemk7/modules/nmap/download"}]

How do I get this download and install to work ?

/Regards T.

Link to comment
Share on other sites

When I can't find any answer in the documentation regarding how to use the API, I start a web browser and open the dev console in the browser and check what happens as I do the same thing using the web UI. The API params used will show. So, in this case I just added a module in the web UI and looked in the console at the same time and got the param used.

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...