Jump to content

SSID Manager module


Noth

Recommended Posts

Hi !

I've just finished developing my first module for "/etc/pineapple/ssid_file" management.

This module allows you to:

  - Backup the SSID pool file

  - View/Delete backups

  - Restore backups

  - Merge all SSID to a single file and restore it

 

Everything is available on:  https://github.com/NothNoth/SSIDPool/tree/master

 

Enjoy !

 

  Noth

Link to comment
Share on other sites

  • 1 month later...

whenever I try to download it from github, my computer tells me there is a virus detected and fails to download.

Edited by b0N3z
Link to comment
Share on other sites

3 hours ago, b0N3z said:

whenever I try to download it from github, my computer tells me there is a virus detected and fails to download.

Well for now you'll have to scp the module to your Pineapple. I meant that I have no idea how modules are selected to appear in the "official" list of modules on the modules manager ;)

 

About the Virus: well, I don't know how your antivirus finds something in my 50 lines of js + php.. ;)

Link to comment
Share on other sites

I have windows defender, thats it.  When I download the zip file from your github page it says what i posted above.  Im using chrome browser.

Link to comment
Share on other sites

So I finally got around to putting on my nano and seems really cool.  Hopefully this week I will have time to mess with it a little.  Still dont know why chome wouldnt download the zip from the github, but a simple git clone fixed that.

 

Update:  The Current SSID pool count is always 1 off.  Starting at -1 when there are no ssid in the PineAP pool.  I found a fix under module.php

    private function getSSIDCount()
    {
      $ssidfile = "/etc/pineapple/ssid_file";
      $this->response = array("error" => "",
                              "ssidCount" => count(file($ssidfile)) - 1 );  <----- change the 1 to a 0 so it looks like )) - 0 );
   
}

    private function getSSIDPool()
    {

I have modified this on mine and seems to have fixed the count on the SSID pool in the module.

Edited by b0N3z
Link to comment
Share on other sites

Just now, sud0nick said:

You could also just not subtract anything and return the number of elements :wink:.

for not knowing to much about coding still, i was pretty happy it worked lol.  when you say element, in this case, that would be the number off ssid it should be showing?

Link to comment
Share on other sites

Sort of, the file() function in PHP returns an array of lines from the file.

$lines = file($ssidFile);

This allows us to access each line of the file individually by using its index which would be n-1 where n is the line number you want.

// Echo line 1
echo $lines[0];

// Echo line 2
echo $lines[1];

So to get the number of lines in the file we can use the count() function to count the number of elements in the array.

echo count($lines);

In this particular case the SSID file contains one SSID per line.  So the number of lines in the file is equal to the number of SSIDs.  I think Noth may have confused the principle of zero indexing an array with getting its number of elements which is why they subtracted one from the count.

  • Upvote 1
Link to comment
Share on other sites

On 05/02/2017 at 11:41 PM, sud0nick said:

Sort of, the file() function in PHP returns an array of lines from the file.


$lines = file($ssidFile);

This allows us to access each line of the file individually by using its index which would be n-1 where n is the line number you want.


// Echo line 1
echo $lines[0];

// Echo line 2
echo $lines[1];

So to get the number of lines in the file we can use the count() function to count the number of elements in the array.


echo count($lines);

In this particular case the SSID file contains one SSID per line.  So the number of lines in the file is equal to the number of SSIDs.  I think Noth may have confused the principle of zero indexing an array with getting its number of elements which is why they subtracted one from the count.

 

Hi,

 

Actually, in my case, there was a trailing \n\r at then end of SSID file, which was adding an additional fake empty line.

I'll check again and will remove the "-1" if useless !

 

Link to comment
Share on other sites

13 hours ago, b0N3z said:

Just put this on my Tetra and when I backup SSID pool it says failure everytime.

Do you have some kind of error message or something ?

Did you install the module on an external SDCard ? (I didn't actually tested on internal storage)

Link to comment
Share on other sites

10 minutes ago, Noth said:

 

Hi,

 

Actually, in my case, there was a trailing \n\r at then end of SSID file, which was adding an additional fake empty line.

I'll check again and will remove the "-1" if useless !

 

Allright, I pushed the patch, everything seems fine.

Thanks for reporting the bug !

Link to comment
Share on other sites

I just said failure next to the merge ssid button.  Yes it is on the internal storage.  Works great on the nano which is installed on the sd card.

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...