├── .gitignore ├── AUTHORS ├── CHANGELOG ├── CHECKLIST.md ├── LICENSE ├── Makefile ├── README.md ├── development_helper ├── lighttpd_extra.conf └── lighttpd_inside.conf ├── image_stuff ├── OpenWRT_ext4_100MB.img.gz └── OpenWRT_ext4_50MB.img.gz ├── piratebox ├── install.sh ├── piratebox │ ├── bin │ │ ├── avahi_to_sdns.sh │ │ ├── board-autoconf.sh │ │ ├── delete_empty.sh │ │ ├── distribute_file_into_directory.sh │ │ ├── distribute_files.sh │ │ ├── droopy │ │ ├── firewall.sh │ │ ├── flush_dnsmasq.sh │ │ ├── generate_config_files.sh │ │ ├── hooks │ │ │ ├── hook_piratebox_start.sh │ │ │ ├── hook_piratebox_start_done.sh │ │ │ ├── hook_piratebox_stop.sh │ │ │ ├── hook_piratebox_stop_done.sh │ │ │ ├── hook_post_init.sh │ │ │ ├── hook_pre_init.sh │ │ │ └── hook_pre_openwrt_init.sh │ │ ├── install_piratebox.sh │ │ ├── json_generation.sh │ │ ├── piratebox_setup_wlan.sh │ │ ├── rpi_hwclock.sh │ │ ├── shoutbox_daemon.sh │ │ ├── shoutbox_stuff.sh │ │ ├── station_cnt.sh │ │ └── timesave.sh │ ├── conf │ │ ├── avahi │ │ │ ├── avahi-daemon.conf.schema │ │ │ └── services │ │ │ │ ├── http.service │ │ │ │ └── ssh.service │ │ ├── chat_init.txt │ │ ├── dnsmasq_default.conf │ │ ├── firewall.conf │ │ ├── hook_custom.conf │ │ ├── hostapd.conf │ │ ├── hosts │ │ ├── hosts_mesh │ │ ├── ipv6.conf │ │ ├── irc.conf │ │ ├── irc │ │ │ └── motd.txt │ │ ├── json.conf │ │ ├── lighttpd │ │ │ ├── env │ │ │ ├── fastcgi-php-generate203.conf │ │ │ ├── fastcgi-php.conf │ │ │ ├── lighttpd.conf │ │ │ └── mime.types │ │ ├── node.conf │ │ └── piratebox.conf │ ├── init.d │ │ ├── piratebox │ │ └── piratebox_alt │ ├── lib │ │ ├── json_func.sh │ │ ├── node_name_generation.sh │ │ └── node_name_resolution.sh │ ├── python_lib │ │ ├── .keep │ │ ├── broadcast.py │ │ ├── discover.py │ │ ├── diskusage.py │ │ ├── messages.py │ │ ├── psogen.py │ │ ├── psutil.py │ │ └── style.css │ ├── rpi │ │ ├── bin │ │ │ ├── do_switch_client.sh │ │ │ ├── run_client.sh │ │ │ ├── sdcard_share.sh │ │ │ ├── starter.sh │ │ │ ├── switch_to_client.sh │ │ │ ├── usb_share.sh │ │ │ └── wifi_detect.sh │ │ ├── services │ │ │ ├── piratebox.service │ │ │ ├── rpi_hwclock.service │ │ │ └── timesave.service │ │ └── udev │ │ │ └── 99-wifi.rules │ ├── share │ │ └── .keep │ ├── src │ │ ├── HEADER.txt │ │ ├── README.txt │ │ ├── forest.css │ │ ├── forest.py │ │ ├── kareha.pl │ │ ├── kareha_img_config.pl │ │ ├── linux.example.minidlna.conf │ │ ├── no_forum.html │ │ ├── no_link.html │ │ ├── openwrt.example.minidlna │ │ └── redirect.html.schema │ ├── tmp │ │ └── .keep │ ├── www │ │ ├── .READ.ME.htm │ │ ├── cgi-bin │ │ │ ├── data.pso │ │ │ ├── diskwrite.py │ │ │ ├── psoread.py │ │ │ ├── psowrte.py │ │ │ └── style.css │ │ ├── generate_204 │ │ ├── index.html │ │ ├── library │ │ │ └── test │ │ │ │ └── success.html │ │ ├── ncsi.txt │ │ ├── station_cnt.txt │ │ └── upload_handler │ │ │ └── files │ │ │ └── .gitignore │ └── www_content │ │ ├── css │ │ ├── jquery-ui.min.css │ │ └── page_style.css │ │ ├── favicon.ico │ │ ├── img │ │ ├── menu.png │ │ ├── piratebox-logo-horizontal-white.png │ │ └── piratebox-logo-small.png │ │ ├── index.html │ │ ├── js │ │ ├── jquery-ui.min.js │ │ ├── jquery.min.js │ │ ├── l10n.js │ │ └── scripts.js │ │ └── locales │ │ ├── data.de.properties │ │ ├── data.en.properties │ │ ├── data.es.properties │ │ ├── data.eu.properties │ │ ├── data.fr.properties │ │ ├── data.pt-br.properties │ │ ├── data.ru.properties │ │ └── locales.ini └── readme.txt └── rpi.motd-template.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.swp 3 | piratebox/piratebox/version 4 | piratebox/piratebox/www/chat_content.html 5 | image_stuff/* 6 | piratebox_ws_* 7 | piratebox-ws_* 8 | tmp/* 9 | piratebox/piratebox/bin/miniircd.py 10 | piratebox/piratebox/www/Shared 11 | piratebox/piratebox/www/cgi-bin/data.pso 12 | piratebox/piratebox/rpi/motd.txt 13 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Based on idea of David Darts: http://daviddarts.com 2 | 3 | Script collection by: 4 | Matthias Strubel http://piratebox.aod-rpg.de 5 | 6 | Live CD & Installer by: 7 | TerrorByte ~ Cale Blac k 8 | 9 | Contributors for modifications: 10 | # stylesuxx - Makefile and development support 11 | # FriedZombie - OpenWRT and scripting support 12 | # someguy - Droopy Directory support 13 | # Reventlov - Modification for better iOS Support 14 | # someguy - Modifications for running on OpenWRT 15 | # ToM'aSs - Languag-Support 16 | # Liblor - Fixes 17 | # Loris Reiff 18 | # iamarf 19 | # denis-d 20 | # taffy-nay 21 | # risca 22 | # herr-gabriel 23 | # Jess Stubenbord 24 | # Mike Weaver 25 | # bartschat - RTC RPi feature 26 | # casdr 27 | # jdieg0 28 | # a-ira 29 | # ponsfrilus 30 | # ... and all others I might have forgotten. 31 | 32 | 33 | Design: 34 | * David Brooks 35 | 36 | Based on Software: 37 | * Droopy - http://stackp.online.fr/?p=28 38 | * forest.py - http://www.triv.org.uk/~nelis/forest/ 39 | * kareha - http://wakaba.c3.cx/s/web/wakaba_kareha 40 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | CHANGELOG 2 | 3 | === 1.1.4 === 4 | * [New] Removed legacy redirect.html, use /index.html only 5 | * [New] install_piratebox.sh, avoid distribution of index files, if turned off. 6 | * [New] mime.types: Adding gpx mime-type 7 | * [New] [i8n] Spanish and Basque 8 | * [New] [i8n] Russian translation 9 | * [New] [RPi] Add all needed things to create a simple on/off button 10 | * [Changed] [RPi] MotD generation reworked and more dynamically 11 | * [Changed] [RPi] Run timesave-save function during shutdown 12 | * [Changed] [RPi] Work with en_US.UTF-8 per default 13 | * [Fix] diskusage: Fix wrong error message 14 | * [Fix] lang-de ; fix grammar 15 | * [Fix] [RPi] Fix wrong path in wifi client helper script 16 | * [Fix] [RPi] Fix issue with diskusage generation & usb share 17 | * [Fix] [RPi] Enable cronie for startup, which was missing 18 | * [Fix] [RPi] Fixed resolv.conf. A default entry is now available 19 | * [Fix] [RPi] Fixed detection of 8188eu 20 | * [Fix] [RPi] Store the installed hostap package in /prebuild/hostapd 21 | * [Fix] initd: minircd startup fix setuid 22 | * [Fix] initd: minircd fixing start-stop issues 23 | * [Fix] initd: Fix radvd path to an absolute path 24 | * [Fix] initd: Ugly hack for absolute path of radvd on OpenWrt 25 | * [Fix] WWW-Content, fix a syntax error which broke jQuery 26 | * [Fix] Refresh kareha download URL, which changed in year 2015 27 | * [Fix] diskusage: Adding missing tag 28 | * [Fix] timesave: Shellcheck issues fixed 29 | * [Fix] timesave: Problems with date & time format at RPi fixed 30 | 31 | 32 | === 1.1.3 === 33 | * [New] Translation bt-pr 34 | * [New] [RPi] Helper scripts to jump to wifi client mode 35 | * [New] [RPi] Helper script to use SDCard without reboot 36 | * [New] [RPi] Image adjustments to save SDCard for to many writes 37 | * [Fix] Some shell incompatibilities 38 | * [Fix] forest.py : Cleanup used folders 39 | * [Fix] Fixed localization ID for placeholder message 40 | * [Fix] Correct/translate German localisation strings 41 | * [Fix] Adjust hostapd.conf with comments & addtional parameter for n-mode wifi 42 | * [Fix] Some help about setting up WPA2 mode for AP in hostapd.conf 43 | * [Fix] Reduce browser cache to a minimum, which solves issues with shoutbox and diskusage 44 | * [Fix] Trigger async disk usage refresh during page load 45 | 46 | === 1.1.2 === 47 | * [Fix] Upgrade 1.1.x - 1.1.x does not create content symlink 48 | 49 | === 1.1.1 === 50 | * [Fix] Translation en,fr LibraryBox -> PirateBox 51 | * [Fix] Spellings in translation 52 | * [Fix] IRC startup command failed. 53 | * [Removed] exchange_www.sh 54 | 55 | === 1.1.0 === 56 | * [New] Enable / Disable file provisioning for custom lighttpd directory listing 57 | * [New] ChatBox message is now in conf/chat_init.txt 58 | * [New] Disable the Shoutbox to prevent writing into it 59 | * [New] PHP configuration shipped, to enable easily for modifications 60 | * [New] Mesh implementation, technical preview 61 | * [New] JSON config file to direct client side applications, like "share apps" 62 | * [New] Simply python IRC Server installed and prepareable for automatic start 63 | * [New] Shoutbox-Time via Client-Date possible 64 | * [New] Website is now available under /content and /opt/piratebox/share 65 | * [New] [RPi] Service files for using a RTC at PiratBox 66 | * [New] Redirect all DNS requests to local box via firewall (custom script) 67 | * [New] Redirect all web request option via firewall (disabled) (custom script) 68 | * [New] [OpenWrt] Redirect all DNS requests to local box via firewall 69 | * [New] [OpenWrt] Redirect all web request option via firewall (disabled) 70 | * [New] [OpenWrt] Enable all wifi devices with the PirateBox SSID 71 | * [New] [OpenWrt] AP Client isolation activated per default 72 | * [Changed] Send HTTP-Code 204 via PHP, much cleaner 73 | * [Changed] Update jQuery to 2.2.3, removes IE <=8 support 74 | * [Changed] Redirect happens now always to wished domain name 75 | * [Changed] Droopy, make chmod operation optional (prevent errors on OpenWRT) 76 | * [Fix] License Adjustments 77 | * [Fix] Prevent JS Injection in Shoutbox 78 | * [Fix] Shoutbox: Missing blank between author and content 79 | * [Fix] Fix problem when running in small display mode at direcotry listing. 80 | * [Fix] Add xhtml mime type in lighttpd configuration 81 | 82 | === 1.0.7 === 83 | * [New] Lock shoutbox when you send a message. 84 | * [New] Display disk space usage on front page. 85 | * [New] Add webm mime-type to lighttpd 86 | * [RPi] [New] RPi2 and Zero support 87 | * [RPi] [New] USB activation scripts. 88 | * [RPi] [New] udev rules for piratebox activation 89 | * [RPi] [New] Script for activating the correct hostap for Realtek chipsets 90 | * [RPI] [New] wpa_supplicant fallback if no AP enabled WiFi device was found 91 | * [Fix] Send a proper HTTP Reason code back 92 | * [Fix] Fix version number in RPi MOTD. 93 | * [Fix] Insert mime-type for .svg 94 | * [Fix] Improve Shoutbox update speed after sending a message. 95 | * [Fix] Do not cleanup the rootfs if Shared folder does not exist. 96 | * [Fix] Improved comparison of timestamps on RPi. 97 | * [Fix] Improved MOTD for RPi. 98 | * [Fix] Improved initialization of the board. 99 | 100 | === 1.0.6 === 101 | * [Fix] Styling of the upload box iframe was quite ugly. 102 | 103 | === 1.0.5 === 104 | * [New] Improved styling for droopy iframe. 105 | * [New] Timesave script service file to run set the time during startup. 106 | * [Fix] Droopy call in init.d/piratebox failed to use the correct port. 107 | * [Fix] Timesave script behaviour fixed on full Linux systems. 108 | * OpenWrt's date format is now customized during build & piratebox.conf . 109 | 110 | === 1.0.4 === 111 | * [New] New feature: /opt/piratebox/bin/board-autoconf.sh for setting up the imageboard 112 | * [New] Droopy update: Multiple upload 113 | * [New] Droopy update: In general user/password setting (non configurable via 114 | PirateBox) 115 | * [New] imageboard: inital dummy page for a not installed board. 116 | * [New] Send HTTP-Code 204 for Android devices, avoids captive Portal and leaving devices. 117 | 118 | * [Fix] Some script cleanups 119 | * [Fix] Improved Cachehandling 120 | * [Fix] Modified index HTML structure for increased stylability 121 | * [Fix] Droopy update: Language encoding 122 | * [Fix] Droopy update: Uploaded filepermission can be configured. 123 | PirateBox default: 755 124 | * [Fix] Fix not refreshing shoutbox after bootup 125 | * [Fix] Show station count again, after it is enabled 126 | 127 | * [Removed] Droopy update: Include hostname to templates (not needed anymore) 128 | * [Removed] Droopy update: Field including iframe for shoutbox (not needed anymore) 129 | * [Removed] Droopy update: iOS fake answer code, which was included in lighttpd since 130 | Piratebox 0.5.x 131 | * [Removed] exchange_www.sh : This feature is not available anymore, because it breaks 132 | more then it helps. 133 | * [Removed] Unnessecary AJAX calls & files from pre 1.0 134 | 135 | === 1.0.3 === 136 | 137 | (skipped) 138 | 139 | === 1.0.2 === 140 | * [Fix] Settings for correct permission of shoutbox files 141 | * [Fix] Broken probe function in some shells 142 | * [Fix] Issues with Python scripts on some plattforms 143 | * [Fix] Fixes in installation script 144 | * [Fix] Distribute files did not work with folder containing whitespaces 145 | * [Fix] Fixed CSS issue with the shoutbox 146 | 147 | === 1.0.1 === 148 | * [Fix] Fixed setting permissions of shoutbox datafile 149 | * [New] Service File for RPi image 150 | * [Fix] Several typos in scripts 151 | * [Fix] Typo in front page and directory listing 152 | * [Fix] in timsave.sh while restoring date&time 153 | * [Fix] [OpenWRT] Timesave create bootup restore 154 | * [Fix] [OpenWRT] Fix for not working "already installed" recognition to skip parts 155 | * [Fix] [OpenWRT] Fix for errors during installing piratebox-mod-imageboard because of duplicate links 156 | * [Fix] [OpenWRT] Fix for LED flashing during auto install (box-installer on image) 157 | * [Fix] [OpenWRT] Fix error messages on package reinstall. (extendRoot) 158 | * [Fix] No dublicates symlink after double "part2" via install_piratebox.sh 159 | * [New] Remove # in front of secret & password to force user to change it before using the board 160 | * [Fix] Button padding in UI 161 | * [Fix] Board Link out of nested Shared folder 162 | * [Fix] Russian Translation in Droopy 163 | * [Fix] ReDistribute DirectoryListing files upon initialization on first Startup 164 | * [Fix] [OpenWRT] Fixing customization of lease-file location for OpenWRT 165 | * [Fix] [OpenWRT] Fixes issues when extendRoot couldn't get initilized correctly 166 | * [New] [OpenWRT] Optimized handling of mount options in extendRoot 167 | * [Fix] [RPi] Bootup issue with some USB-wifi sticks. 168 | * [Fix] Prevent XSS in forest.py 169 | 170 | === 1.0.0 === 171 | NOTE: This may only be a partial changelog, check github / your package manager for more info. 172 | 173 | * Overwork into new Responsive design 174 | * New Frontpage 175 | * Directory Listing in design 176 | * Configuration in lighttpd.conf 177 | * During startup README.txt & HEADER.txt get copied into /opt/piratebox/share/Shared folder 178 | -> Exisiting files won't be overwritten! 179 | -> Scripts can be used in console with overwrite parameter do distribute your own files 180 | * [New] install method 181 | * [New] install dependencies 182 | * [Fixed] General cleaning 183 | * [Removed] [Testing] Executable, we will stick to service based 184 | * [Fixed] Overwritten saved timestamp with 1970 one 185 | * [New] possibility in install_piratebox.sh to exchange the hostname easily 186 | * [New] Moved DHCP leasefile into memory on OpenWRT system (/tmp is memory) 187 | * [Fix] Timesave script does not contain parts for OpenWRT anymore 188 | * [Fix] Timesave-file location is now configured in piratebox.conf 189 | * [Fix] Fix in Changing hostname functionality 190 | * [New] Hostname changing generates the redirect.html now based on a Schema file 191 | * [New] Added JSON Mime-Type 192 | * [Fix] Enable unescaped blanks in Upload-Folder 193 | * [Fix] iOS 7 captive Portal fix 194 | * [New] Sample configuration for UPnP Server 195 | 196 | === v0.6G === 197 | * [Fixed] Hide dot files in directory-listing which are usually hidden files 198 | * [New] Image file is ext4 and 50MB 199 | * [Fix] Fixed captive Portal detection for iOS7 200 | -------------------------------------------------------------------------------- /CHECKLIST.md: -------------------------------------------------------------------------------- 1 | # Image Testing Checklist 2 | If you are part of the testing team, this Checklist is for you. 3 | 4 | ## For RaspberryPi 5 | Download the image, dump it to SD card, connect your PirateBox to the same network the computer you are testing from is connected to and then go through the checklist step by step to make sure everything is working as it should. 6 | Before going through the checklist, make sure your USB WiFi is attached and is one of the supported types. Also make sure you have a *FAT32* formatted USB thumb drive attached to your RPi. 7 | 8 | ## For OpenWrt 9 | Download the corresponding install_piratebox.zip and .bin file for your device. If you have already a PirateBox running, follow the upgrade instructions. If you install your Software on a fresh device, follow the installation howto 10 | Make sure you PirateBox stopped flashing (indicating the installation is running). On PirateBox 1.1.0 the installation happens in multiple interations. 11 | 12 | 13 | ## Checklist 14 | (Skip sections which are not valid for your architecture). 15 | 16 | ### Initial configuration setup 17 | * [ ] PirateBox' WiFi is available 18 | * [ ] Connection to PirateBox' WiFi could be established 19 | * [ ] **RPi only** SSH connection to PirateBox with the username *alarm* and the password *alarm* could be established 20 | * [ ] **RPi only** Message of the day containing information about *First Steps* is displayed correctly 21 | * [ ] **RPi only** Change the password for the *alarm* user, log out and log back in 22 | * [ ] **RPi only** Enable USB share 23 | * [ ] Set some date and enable Fake-timeservice 24 | * [ ] Enable Kareha Image and Discussion Board 25 | * [ ] Enable UPnP media server (minidlna) 26 | * [ ] It is possible to post to the chat 27 | * [ ] It is possible to upload files 28 | * [ ] It is possible to post to the board 29 | * [ ] Reboot 30 | * [ ] PirateBox' WiFi is available 31 | * [ ] Connection to PirateBox' WiFi could be established 32 | * [ ] Date matches the set date from the Fake-timeservice 33 | 34 | ### Functional tests 35 | **UI in General** 36 | * [ ] UI looks proper, no ugly overlapping 37 | * [ ] UI is responsive on small browser size; is adjusts the look 38 | * [ ] Every URL is working, on main screen 39 | * [ ] Title URLs to mainscreen and Forum are working in Directory-Listing 40 | 41 | **ImageBoard** 42 | * [ ] It is possible to post new threads 43 | * [ ] These threads can be answered on 44 | * [ ] When I come back later to the imageboard and post a reply, the post order is correct. 45 | * [ ] I can upload files (<5MB) to the posts as well 46 | 47 | **Shoutbox** 48 | * [ ] Different color work in Shoutbox , Username can be changed 49 | * [ ] Posting URLs or other HTML like special characters do not break Shoutbox 50 | 51 | **Upload** 52 | * [ ] Upload of different filetypes works 53 | * [ ] Multiple files can be uploaded 54 | * [ ] The messages inside the upload box are in english or my language 55 | * [ ] Special characters are correctly uploaded 56 | * [ ] It is not possible to upload a file named index.html 57 | 58 | **Directory Listing** 59 | * [ ] Download of files is possible 60 | * [ ] Directory listing reacts responsive on screen size changes 61 | * [ ] Created folders are accessiable (UI is deployed after reboot) 62 | * [ ] URLs to mainpage and forum in subfolder work 63 | * [ ] Special character files uploaded via upload functionality work 64 | 65 | **UPNP Server** 66 | * [ ] Streaming of MP3 works via an UPNP client 67 | * [ ] It is possible to stream videos via UPNP 68 | 69 | **IRC Server** 70 | * [ ] Is started after activation in piratebox.conf 71 | * [ ] With an IRC client, the IRC server is usable 72 | * [ ] New channels can be created 73 | 74 | **Customization** 75 | * [ ] Changes on the folder "content" on the USB Stick (**valid for OpenWrt** and RPI **with USB Storage mod**) are visible on the browser 76 | * [ ] PHP was sucessfully enabled in lighttpd.conf and fastcgi processes are visible in "ps" 77 | * [ ] My custom PHP script is working in /content folder 78 | * [ ] Deleting the content folder creates a new folder after a reboot 79 | * [ ] It is possible to change the visible hostname of piratebox using the install_piratebox.sh script 80 | 81 | **Enhanced Network Configuration** 82 | * [ ] Clients with static DNS Server entries work while being connected to PirateBox (PirateBox interferes here) 83 | * [ ] One Client can not ping or connect to another Client (directly via wifi) 84 | * [ ] 85 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | NAME = piratebox-ws 2 | VERSION = 1.1.4 3 | ARCH = all 4 | PB_FOLDER=piratebox 5 | PB_SRC_FOLDER=$(PB_FOLDER)/$(PB_FOLDER) 6 | 7 | PACKAGE_NAME=$(NAME)_$(VERSION) 8 | PACKAGE=$(PACKAGE_NAME).tar.gz 9 | VERSION_FILE=$(PB_FOLDER)/$(PB_FOLDER)/version 10 | MOTD=$(PB_FOLDER)/$(PB_FOLDER)/rpi/motd.txt 11 | 12 | IMAGE_FILE=piratebox_ws_1.1_img.gz 13 | TGZ_IMAGE_FILE=piratebox_ws_1.1_img.tar.gz 14 | SRC_IMAGE=image_stuff/OpenWRT_ext4_50MB.img.gz 15 | SRC_IMAGE_UNPACKED=image_stuff/piratebox_img 16 | MOUNT_POINT=image_stuff/image 17 | OPENWRT_FOLDER=image_stuff/openwrt 18 | OPENWRT_CONFIG_FOLDER=$(OPENWRT_FOLDER)/conf 19 | OPENWRT_BIN_FOLDER=$(OPENWRT_FOLDER)/bin 20 | 21 | WORKFOLDER=tmp 22 | 23 | ###IRC deployment 24 | IRC_GITHUB_ULR=git://github.com/jrosdahl/miniircd.git 25 | IRC_WORK_FOLDER=$(WORKFOLDER)/irc 26 | IRC_SRC_SERVER=$(IRC_WORK_FOLDER)/miniircd 27 | IRC_TARGET_SERVER=$(PB_SRC_FOLDER)/bin/miniircd.py 28 | 29 | .DEFAULT_GOAL = package 30 | 31 | $(IRC_TARGET_SERVER): 32 | mkdir -p $(WORKFOLDER) 33 | git clone $(IRC_GITHUB_ULR) $(IRC_WORK_FOLDER) 34 | cp $(IRC_SRC_SERVER) $(IRC_TARGET_SERVER) 35 | 36 | $(MOTD): 37 | sed -e 's|##version##|$(VERSION)|' rpi.motd-template.txt > $@ 38 | 39 | $(VERSION): 40 | echo "$(PACKAGE_NAME)" > $(VERSION_FILE) 41 | echo `git status -sb --porcelain` >> $(VERSION_FILE) 42 | echo ` git log -1 --oneline` >> $(VERSION_FILE) 43 | 44 | $(PACKAGE): $(IRC_TARGET_SERVER) $(VERSION) $(MOTD) 45 | tar czf $@ $(PB_FOLDER) 46 | 47 | $(IMAGE_FILE): $(IRC_TARGET_SERVER) $(VERSION) $(SRC_IMAGE_UNPACKED) $(OPENWRT_CONFIG_FOLDER) $(OPENWRT_BIN_FOLDER) $(MOTD) 48 | mkdir -p $(MOUNT_POINT) 49 | echo "#### Mounting image-file" 50 | sudo mount -o loop,rw,sync $(SRC_IMAGE_UNPACKED) $(MOUNT_POINT) 51 | echo "#### Copy content to image file" 52 | sudo cp -vr $(PB_SRC_FOLDER)/* $(MOUNT_POINT) 53 | echo "#### Copy customizatiosns to image file" 54 | sudo cp -rv $(OPENWRT_FOLDER)/* $(MOUNT_POINT)/ 55 | echo "#### Umount Image file" 56 | sudo umount $(MOUNT_POINT) 57 | gzip -rc $(SRC_IMAGE_UNPACKED) > $(IMAGE_FILE) 58 | 59 | 60 | $(OPENWRT_CONFIG_FOLDER): 61 | mkdir -p $@ 62 | cp -rv $(PB_SRC_FOLDER)/conf/* $@ 63 | sed 's:OPENWRT="no":OPENWRT="yes":' -i $@/piratebox.conf 64 | sed 's:DO_IFCONFIG="yes":DO_IFCONFIG="no":' -i $@/piratebox.conf 65 | sed 's:IPV6_ENABLE="no":IPV6_ENABLE="yes":' -i $@/ipv6.conf 66 | sed 's:USE_APN="yes":USE_APN="no":' -i $@/piratebox.conf 67 | sed 's:DNSMASQ_INTERFACE="wlan0":DNSMASQ_INTERFACE="br-lan":' -i $@/piratebox.conf 68 | sed 's:192.168.77:192.168.1:g' -i $@/piratebox.conf 69 | sed 's:DROOPY_USE_USER="yes":DROOPY_USE_USER="no":' -i $@/piratebox.conf 70 | sed 's:DROOPY_CHMOD:#DROOPY_CHMOD:' -i $@/piratebox.conf 71 | sed 's:LEASE_FILE_LOCATION=$$PIRATEBOX_FOLDER/tmp/lease.file:LEASE_FILE_LOCATION=/tmp/lease.file:' -i $@/piratebox.conf 72 | sed 's:TIMESAVE_FORMAT="+%C%g%m%d %H%M":TIMESAVE_FORMAT="+%C%g%m%d%H%M":' -i $@/piratebox.conf 73 | sed 's:FIREWALL_FETCH_DNS="yes":FIREWALL_FETCH_DNS="no":' -i $@/firewall.conf 74 | sed 's:FIREWALL_FETCH_HTTP="yes":FIREWALL_FETCH_HTTP="no":' -i $@/firewall.conf 75 | 76 | 77 | $(OPENWRT_BIN_FOLDER): 78 | mkdir -p $@ 79 | cp -v $(PB_SRC_FOLDER)/bin/droopy $@ 80 | sed "s:libc.so.6:libc.so.0:" -i $@/droopy 81 | 82 | $(TGZ_IMAGE_FILE): 83 | tar czf $(TGZ_IMAGE_FILE) $(SRC_IMAGE_UNPACKED) 84 | 85 | 86 | $(SRC_IMAGE_UNPACKED): 87 | gunzip -dc $(SRC_IMAGE) > $(SRC_IMAGE_UNPACKED) 88 | 89 | 90 | package: $(PACKAGE) 91 | 92 | all: package shortimage 93 | 94 | clean: cleanimage 95 | rm -fr $(WORKFOLDER) 96 | rm -fr $(IRC_WORK_FOLDER) 97 | rm -f $(IRC_TARGET_SERVER) 98 | rm -f $(PACKAGE) 99 | rm -f $(VERSION_FILE) $(MOTD) 100 | 101 | cleanimage: 102 | - rm -f $(TGZ_IMAGE_FILE) 103 | - rm -f $(SRC_IMAGE_UNPACKED) 104 | - rm -fr $(OPENWRT_CONFIG_FOLDER) 105 | - rm -v $(IMAGE_FILE) 106 | - rm -rv $(OPENWRT_BIN_FOLDER) 107 | 108 | 109 | shortimage: $(IMAGE_FILE) $(TGZ_IMAGE_FILE) 110 | 111 | 112 | 113 | .PHONY: all clean package shortimage 114 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PirateBoxScripts with Modifications for running in a Webserver 2 | 3 | [![Join the chat at https://gitter.im/PirateBox-Dev/PirateBoxScripts_Webserver](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/PirateBox-Dev/PirateBoxScripts_Webserver?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | 5 | © 2012-2019 [Matthias Strubel](mailto:matthias.strubel@aod-rpg.de) 6 | 7 | Licensed under the GNU GPLv3 8 | 9 | ## Maintainers 10 | * [Matthias Strubel](matthias.strubel@aod-rpg.de) 11 | 12 | 13 | PirateBox is a collection of scripts / programs that allows you to use your wireless card 14 | as a local network to share files and chat anonymously. For more information please visit 15 | [piratebox.cc](https://piratebox.cc) 16 | 17 | ## Info 18 | Packages contains only scripts based PirateBox scripts with running lighttpd webserver. 19 | 20 | PirateBox scripts can: 21 | * Setup WLAN Interface via iw 22 | * Setup hotspot functionality (hostapd) 23 | * Setup IP Adresses of wlan interface 24 | * Proping until USB-WLAN is available 25 | * Can add wlan interface to an existing bridge 26 | * Sets Up a DHCP Server with redirect to wlan-interface IP 27 | * Upload landing page (via iframe droopy) 28 | * Browse Uploaded files 29 | * Announce "Internet yes" for iOS 30 | * Announce "Internet yes" for MS devices 31 | * ShoutBox 32 | * Optional small Python forum 33 | * Optional imageboard 34 | * Optional Station counter 35 | * Optional Inihibit starting upload-script 36 | * Optional Timesave script (for devices without RTC) - can be found in piratebox/bin/timesave.sh 37 | * Optional Poll for WLAN device until it available (for USB wifi cards) 38 | * Optional IRC-Server 39 | 40 | More information can be found on [piratebox.cc](https://piratebox.cc) 41 | Installation tutorial and current download link: [piratebox.cc/getting_started](https://piratebox.cc/getting_started) 42 | 43 | Is supported by [mkPirateBox](https://github.com/MaStr/mkPirateBox) > v0.5 for OpenWRT Systems 44 | and by [PirateBox Manager](https://github.com/TerrorByte/PirateBox-Manager) 45 | 46 | ## Installation 47 | PirateBox should be in most common repositories soon, but in the meantime you can go to [piratebox.cc/getting_started](https://piratebox.cc/getting_started) 48 | 49 | ## Note 50 | PirateBox is going to be discontinued. Read [this forum post](https://forum.piratebox.cc/read.php?9,23070) for more information. 51 | 52 | 53 | 63 | -------------------------------------------------------------------------------- /development_helper/lighttpd_extra.conf: -------------------------------------------------------------------------------- 1 | ## Configuration for Piratebox 2 | 3 | server.modules = ( 4 | # "mod_access", not needed! 5 | "mod_alias", 6 | # "mod_compress", Disabled, fixing reload Problem?? 7 | "mod_redirect", 8 | # "mod_rewrite", 9 | "mod_setenv", 10 | ) 11 | 12 | var.basedir=env.HOME + /tmp 13 | 14 | server.document-root = basedir + "/www" 15 | 16 | 17 | ## Locate the tmp storage into tmp. It is in most cases the ram 18 | ## Limit the uploads to 4MB to save - especially on small devices 19 | ## the device from dieing because OUT-OF-RAM exceptions 20 | ## in KB => 4MB 21 | server.upload-dirs = ( "/tmp" ) 22 | server.max-request-size = 4048 23 | 24 | server.errorlog = "/tmp/error.log" 25 | server.breakagelog = "/tmp/break.log" 26 | server.pid-file = "/tmp/lighttpd.pid" 27 | 28 | 29 | index-file.names = ( "index.php", "index.html", 30 | "index.htm", "default.htm", 31 | " index.lighttpd.html" ) 32 | 33 | url.access-deny = ( "~", ".inc" ) 34 | 35 | # added .cgi .py 36 | static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" , ".cgi" , ".py" ) 37 | 38 | 39 | # Enable lighttpd on ipv6 40 | $SERVER["socket"] == "[::]:8001" { } 41 | server.port = 8001 42 | 43 | dir-listing.encoding = "utf-8" 44 | server.dir-listing = "enable" 45 | 46 | # Grabs main css 47 | dir-listing.external-css = "/css/page_style.css" 48 | 49 | # Header 50 | # Enables header section 51 | dir-listing.show-header = "enable" 52 | dir-listing.encode-header = "disable" 53 | # Hides HEADER.txt from listing 54 | dir-listing.hide-header-file = "enable" 55 | 56 | # Footer 57 | # Enables footer section 58 | dir-listing.show-readme = "enable" 59 | dir-listing.encode-readme = "disable" 60 | # Hides README.txt from listing 61 | dir-listing.hide-readme-file = "enable" 62 | # Diables default footer text 63 | dir-listing.set-footer = " " 64 | 65 | ## custom MIME-Type support 66 | include "piratebox/piratebox/conf/lighttpd/mime.types" 67 | 68 | #----------- cgi.conf -------------- 69 | server.modules += ( "mod_cgi" ) 70 | 71 | $HTTP["url"] =~ "^/cgi-bin/" { 72 | cgi.assign = ( ".py" => "/usr/bin/python2" ) 73 | } 74 | 75 | $HTTP["url"] =~ "^/board/" { 76 | cgi.assign = ( ".pl" => "/usr/bin/perl" , ) 77 | } 78 | #------------------------------------- 79 | 80 | 81 | 82 | # 404 Error Page with redirect 83 | # 84 | #server.error-handler-404 = "/index.html" 85 | 86 | ## for better debugging 87 | #server.modules += ( "mod_accesslog" ) 88 | #accesslog.filename = "/tmp/access.log" 89 | 90 | 91 | 92 | include "piratebox/piratebox/conf/lighttpd/fastcgi.conf" 93 | 94 | 95 | setenv.add-environment = ( 96 | "SHOUTBOX_GEN_HTMLFILE" => basedir "/chat_content.html" , 97 | "SHOUTBOX_CHATFILE" => basedir + "/cgi-bin/data.pso" , 98 | "SHOUTBOX_CLIENT_TIMESTAMP" => "yes" 99 | ) 100 | -------------------------------------------------------------------------------- /development_helper/lighttpd_inside.conf: -------------------------------------------------------------------------------- 1 | ## Configuration for Piratebox 2 | 3 | server.modules = ( 4 | # "mod_access", not needed! 5 | "mod_alias", 6 | # "mod_compress", Disabled, fixing reload Problem?? 7 | "mod_redirect", 8 | # "mod_rewrite", 9 | "mod_setenv", 10 | ) 11 | 12 | var.basedir=env.PWD 13 | 14 | server.document-root = basedir + "/piratebox/piratebox/www" 15 | 16 | 17 | ## Locate the tmp storage into tmp. It is in most cases the ram 18 | ## Limit the uploads to 4MB to save - especially on small devices 19 | ## the device from dieing because OUT-OF-RAM exceptions 20 | ## in KB => 4MB 21 | server.upload-dirs = ( "/tmp" ) 22 | server.max-request-size = 4048 23 | 24 | server.errorlog = "/tmp/error.log" 25 | server.breakagelog = "/tmp/break.log" 26 | server.pid-file = "/tmp/lighttpd.pid" 27 | 28 | 29 | index-file.names = ( "index.php", "index.html", 30 | "index.htm", "default.htm", 31 | " index.lighttpd.html" ) 32 | 33 | url.access-deny = ( "~", ".inc" ) 34 | 35 | # added .cgi .py 36 | static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" , ".cgi" , ".py" ) 37 | 38 | 39 | # Enable lighttpd on ipv6 40 | $SERVER["socket"] == "[::]:8001" { } 41 | server.port = 8001 42 | 43 | dir-listing.encoding = "utf-8" 44 | server.dir-listing = "enable" 45 | 46 | # Grabs main css 47 | dir-listing.external-css = "/css/page_style.css" 48 | 49 | # Header 50 | # Enables header section 51 | dir-listing.show-header = "enable" 52 | dir-listing.encode-header = "disable" 53 | # Hides HEADER.txt from listing 54 | dir-listing.hide-header-file = "enable" 55 | 56 | # Footer 57 | # Enables footer section 58 | dir-listing.show-readme = "enable" 59 | dir-listing.encode-readme = "disable" 60 | # Hides README.txt from listing 61 | dir-listing.hide-readme-file = "enable" 62 | # Diables default footer text 63 | dir-listing.set-footer = " " 64 | 65 | ## custom MIME-Type support 66 | include basedir + "/piratebox/piratebox/conf/lighttpd/mime.types" 67 | 68 | #----------- cgi.conf -------------- 69 | server.modules += ( "mod_cgi" ) 70 | 71 | $HTTP["url"] =~ "^/cgi-bin/" { 72 | cgi.assign = ( ".py" => "/usr/bin/python2" ) 73 | } 74 | 75 | $HTTP["url"] =~ "^/board/" { 76 | cgi.assign = ( ".pl" => "/usr/bin/perl" , ) 77 | } 78 | #------------------------------------- 79 | 80 | 81 | 82 | # 404 Error Page with redirect 83 | # 84 | #server.error-handler-404 = "/index.html" 85 | 86 | ## for better debugging 87 | #server.modules += ( "mod_accesslog" ) 88 | #accesslog.filename = "/tmp/access.log" 89 | 90 | 91 | 92 | include basedir + "/piratebox/piratebox/conf/lighttpd/fastcgi.conf" 93 | 94 | 95 | setenv.add-environment = ( 96 | "PYTHONPATH" => basedir + "/piratebox/piratebox/python_lib" , 97 | "SHOUTBOX_GEN_HTMLFILE" => basedir + "/piratebox/piratebox/www/chat_content.html" , 98 | "SHOUTBOX_CHATFILE" => basedir + "/piratebox/piratebox/www/cgi-bin/data.pso" , 99 | "SHOUTBOX_CLIENT_TIMESTAMP" => "yes" 100 | ) 101 | -------------------------------------------------------------------------------- /image_stuff/OpenWRT_ext4_100MB.img.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PirateBox-Dev/PirateBoxScripts_Webserver/25621d780cc27df4ca5b647a303332709c3aa2ab/image_stuff/OpenWRT_ext4_100MB.img.gz -------------------------------------------------------------------------------- /image_stuff/OpenWRT_ext4_50MB.img.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PirateBox-Dev/PirateBoxScripts_Webserver/25621d780cc27df4ca5b647a303332709c3aa2ab/image_stuff/OpenWRT_ext4_50MB.img.gz -------------------------------------------------------------------------------- /piratebox/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #======================================================================= 3 | # 4 | # FILE: install.sh 5 | # 6 | # USAGE: ./install.sh 7 | # 8 | # DESCRIPTION: Install file for PirateBox. 9 | # 10 | # OPTIONS: ./install.sh 11 | # REQUIREMENTS: --- 12 | # BUGS: Link from install 13 | # NOTES: --- 14 | # AUTHOR: Cale 'TerrorByte' Black, cablack@rams.colostate.edu 15 | # COMPANY: --- 16 | # CREATED: 02.02.2013 19:50:34 MST 17 | # REVISION: 0.3.1 18 | # LICENCE: (c) Cale Black, 2013 GPL-3 19 | #======================================================================= 20 | #Import PirateBox conf 21 | CURRENT_CONF=piratebox/conf/piratebox.conf 22 | scriptfile="$(readlink -f $0)" 23 | CURRENT_DIR="$(dirname ${scriptfile})" 24 | 25 | #Must be root 26 | if [[ $EUID -ne 0 ]]; then 27 | echo "This script must be run as root" #1>&2 28 | exit 0 29 | fi 30 | 31 | if [[ $1 ]]; then 32 | echo "Installing..." 33 | else 34 | echo "Useage: /bin/bash install.sh " 35 | exit 0 36 | fi 37 | 38 | if [[ -f "$CURRENT_DIR"/$CURRENT_CONF ]]; then 39 | . $CURRENT_CONF 2> /dev/null 40 | else 41 | echo "PirateBox config is not in its normal directory" 42 | exit 0 43 | fi 44 | 45 | #begin setting up piratebox's home dir 46 | if [[ ! -d /opt ]]; then 47 | mkdir -p /opt 48 | fi 49 | 50 | cp -rv "$CURRENT_DIR"/piratebox /opt &> /dev/null 51 | echo "Finished copying files..." 52 | echo "$NET.$IP_SHORT piratebox.lan">>/etc/hosts 53 | echo "$NET.$IP_SHORT piratebox">>/etc/hosts 54 | 55 | if [[ -d /etc/init.d/ ]]; then 56 | ln -s /opt/piratebox/init.d/piratebox /etc/init.d/piratebox 57 | echo "To make PirateBox start at boot run: update-rc.d piratebox defaults" 58 | # systemctl enable piratebox #This enables PirateBox at start up... could be useful for Live 59 | else 60 | #link between opt and etc/pb 61 | ln -s /opt/piratebox/init.d/piratebox.service /etc/systemd/system/piratebox.service 62 | echo "To make PirateBox start at boot run: systemctl enable piratebox" 63 | fi 64 | 65 | #install dependencies 66 | #TODO missing anything in $DEPENDENCIES? 67 | # Modified Script by martedì at http://www.mirkopagliai.it/bash-scripting-check-for-and-install-missing-dependencies/ 68 | PKGSTOINSTALL="hostapd lighttpd dnsmasq" 69 | 70 | # If some dependencies are missing, asks if user wants to install 71 | if [ "$PKGSTOINSTALL" != "" ]; then 72 | echo -n "Some dependencies may missing. Would you like to install them? (Y/n): " 73 | read SURE 74 | # If user want to install missing dependencies 75 | if [[ $SURE = "Y" || $SURE = "y" || $SURE = "" ]]; then 76 | # Debian, Ubuntu and derivatives (with apt-get) 77 | if which apt-get &> /dev/null; then 78 | apt-get install $PKGSTOINSTALL 79 | # OpenSuse (with zypper) 80 | #elif which zypper &> /dev/null; then 81 | # zypper in $PKGSTOINSTALL 82 | # Mandriva (with urpmi) 83 | elif which urpmi &> /dev/null; then 84 | urpmi $PKGSTOINSTALL 85 | # Fedora and CentOS (with yum) 86 | elif which yum &> /dev/null; then 87 | yum install $PKGSTOINSTALL 88 | # ArchLinux (with pacman) 89 | elif which pacman &> /dev/null; then 90 | pacman -Sy $PKGSTOINSTALL 91 | # Else, if no package manager has been found 92 | else 93 | # Set $NOPKGMANAGER 94 | NOPKGMANAGER=TRUE 95 | echo "ERROR: No package manager found. Please, manually install: $PKGSTOINSTALL." 96 | fi 97 | fi 98 | fi 99 | 100 | #install piratebox with the given option 101 | case "$1" in 102 | default) 103 | /opt/piratebox/bin/install_piratebox.sh /opt/piratebox/conf/piratebox.conf part2 104 | ;; 105 | board) 106 | /opt/piratebox/bin/install_piratebox.sh /opt/piratebox/conf/piratebox.conf imageboard 107 | echo "############################################################################" 108 | echo "#Edit /opt/piratebox/share/board/config.pl and change ADMIN_PASS and SECRET#" 109 | echo "############################################################################" 110 | ;; 111 | *) 112 | echo "$1 is not an option. Useage: /bin/bash install.sh " 113 | exit 0 114 | ;; 115 | esac 116 | 117 | echo "##############################" 118 | echo "#PirateBox has been installed#" 119 | echo "##############################" 120 | echo "" 121 | echo "Use: sudo service piratebox " 122 | echo "or for systemd systems Use: sudo systemctl piratebox" 123 | exit 0 124 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/avahi_to_sdns.sh: -------------------------------------------------------------------------------- 1 | PIRATEBOX_HOSTS_MESH=/opt/piratebox/conf/hosts_mesh 2 | AVAHI_CACHE_FILE=/tmp/avahi.browse 3 | AVAHI_GEN_OUTPUT="${AVAHI_CACHE_FILE}".hosts 4 | 5 | DNSMASQ_PID=/var/run/piratebox_dnsmasq.pid 6 | 7 | SLEEPTIME=$((60 * 5 )) # Sleep for 5 Minutes before doing a refresh 8 | 9 | PROTOCOLL="_http._tcp" 10 | 11 | while true; do 12 | 13 | ## Browse Avahi discover results and format them into a hosts file 14 | avahi-browse -p -r -t -f $PROTOCOLL | grep -e "=" > $AVAHI_CACHE_FILE 15 | grep \= $AVAHI_CACHE_FILE | \ 16 | sed -e 's|\.local||g' \ 17 | -e 's|_|\.|g' | \ 18 | awk 'BEGIN { FS=";" } { print $8 " " $7; }' > $AVAHI_GEN_OUTPUT 19 | 20 | 21 | echo "# Updated " `date` >> $AVAHI_GEN_OUTPUT 22 | cp $AVAHI_GEN_OUTPUT $PIRATEBOX_HOSTS_MESH 23 | 24 | # Send SIGHUP to dnsmasq for refreshing its cache 25 | kill -1 `cat $DNSMASQ_PID` 26 | sleep $SLEEPTIME 27 | done 28 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/board-autoconf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [[ ! -d /opt/piratebox/share/board ]]; then 4 | echo "You have to install the imageboard first!" 5 | echo "Run (as root):" 6 | echo "\t/opt/piratebox/bin/install_piratebox.sh /opt/piratebox/conf/piratebox.conf imageboard" 7 | else 8 | echo -n "Imageboard admin password: " 9 | read -s BOARDPASSWORD 10 | echo 11 | sed -i "s|xyzPASSWORDzyx|$BOARDPASSWORD|g" /opt/piratebox/share/board/config.pl 12 | 13 | TEMPRAND=$(< /dev/urandom tr -dc A-Za-z0-9_ | head -c128) 14 | sed -i "s|xyzSECRETCODEzyx|$TEMPRAND|g" /opt/piratebox/share/board/config.pl 15 | 16 | sed -i "s|#use constant ADMIN_PASS|use constant ADMIN_PASS|" /opt/piratebox/share/board/config.pl 17 | sed -i "s|#use constant SECRET|use constant SECRET|" /opt/piratebox/share/board/config.pl 18 | 19 | # Remove temporary index page and then try to initialize the board 20 | test -e /opt/piratebox/share/board/index.htm && rm /opt/piratebox/share/board/index.htm 21 | #wget -q -s -O - http://127.0.0.1/board/kareha.pl 2>/dev/null 22 | wget -qO- http://127.0.0.1/board/kareha.pl &> /dev/null 23 | fi 24 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/delete_empty.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Matthias Strubel (c) 2014,2016 - GPL3 4 | # matthias.strubel@aod-rpg.de 5 | # 6 | # This script deletes 0 Byte files 7 | # This script is needed for Piratebox on OpenWrt. 8 | # The find utility there has only a limited feature set. 9 | 10 | IFS=' 11 | ' 12 | 13 | 14 | # Change directory, if not exist exit to not cleanup the 15 | # OS filesystem. 16 | cd $1 || exit 1 17 | 18 | ls_list=$( find ./ -type f ) 19 | 20 | for filename in $ls_list 21 | do 22 | if [ ! -s $filename ] ; then 23 | echo "Deleting 0 Byte file $filename" 24 | rm $filename 25 | fi 26 | done 27 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/distribute_file_into_directory.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # matthias.strubel@aod-rpg.de 4 | # 5 | # The following script is used to distribute a specific file into directories of the givien folder 6 | 7 | directory=$1 8 | src_file=$2 9 | overwrite=$3 10 | overwrite=${overwrite:=false} 11 | 12 | # To enable DEBUG mode, run the following line before startint this script 13 | # export DEBUG=true 14 | DEBUG=${DEBUG:=false} 15 | 16 | TEST_RUN=false 17 | 18 | filename="${src_file##*/}" 19 | 20 | $DEBUG && echo "filename: $filename" 21 | $DEBUG && echo "Overwrite mode : $overwrite " 22 | 23 | if [ ! -e "$directory/$filename" ] || [ "$overwrite" = true ] ; then 24 | echo "Distribute $filename into $directory " 25 | $DEBUG && echo " cp $src_file $directory " 26 | $TEST_RUN || cp "$src_file" "$directory" 27 | else 28 | $DEBUG && echo "File exists" 29 | fi 30 | 31 | 32 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/distribute_files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Matthias Strubel (c) 2014 - GPL3 4 | # matthias.strubel@aod-rpg.de 5 | # 6 | # This script distributes a set of files into $1 folder 7 | 8 | #Script for single stuff 9 | PIRATEBOX_FOLDER=$4 10 | PIRATEBOX_FOLDER=${PIRATEBOX_FOLDER:=/opt/piratebox} 11 | script=$PIRATEBOX_FOLDER/bin/distribute_file_into_directory.sh 12 | 13 | 14 | # To enable DEBUG mode, run the following line before startint this script 15 | # export DEBUG=true 16 | DEBUG=${DEBUG:=false} 17 | 18 | work_on_file() { 19 | local destination_root_folder=$1 20 | local src_file=$2 21 | 22 | find $destination_root_folder -type d -exec $script "{}" $src_file $overwrite ';' 23 | 24 | } 25 | 26 | 27 | 28 | #------------- 29 | 30 | destination=$1 31 | overwrite=$2 32 | overwrite=${overwrite:=false} 33 | src_file=$3 34 | src_file=${src_file:="all"} 35 | 36 | $DEBUG && echo "parameters: 37 | destination $destination 38 | overwrite $overwrite 39 | src_file $src_file 40 | PirateBox_folder=$PIRATEBOX_FOLDER 41 | call script: $script 42 | "; 43 | 44 | if [ "$src_file" = "all" ] ; then 45 | work_on_file $destination $PIRATEBOX_FOLDER/src/HEADER.txt 46 | work_on_file $destination $PIRATEBOX_FOLDER/src/README.txt 47 | else 48 | work_on_file $destination $src_file 49 | fi 50 | 51 | 52 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/firewall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Matthias Strubel (c) 2016 - GPL3 4 | # Script for manipulating firewall rules during start and stop of PirateBox 5 | 6 | PIRATEBOX_CONFIG="/opt/piratebox/conf/piratebox.conf" 7 | FIREWALL_CONFIG="/opt/piratebox/conf/firewall.conf" 8 | 9 | run="" 10 | 11 | help_text(){ 12 | 13 | echo "Script for setting up Firewall rules on PirateBox. (IPv4 only)" 14 | echo " 15 | Usage: 16 | 17 | -s : Start, add IPtables rules 18 | -k : Stop , remove IPtables rules 19 | 20 | -c : different PirateBox config location 21 | -f : different PirateBox firewall config location 22 | " 23 | exit 1 24 | } 25 | 26 | 27 | while getopts "skc:f:" opt ; do 28 | case $opt in 29 | s) run="start" ;; 30 | k) run="end" ;; 31 | c) PIRATEBOX_CONFIG="$OPTARG" ;; 32 | f) FIREWALL_CONFIG="$OPTARG" ;; 33 | h) help_text ;; 34 | \?) 35 | echo "Invalid option: -$OPTARG" 36 | help_text 37 | ;; 38 | esac 39 | done 40 | 41 | if test -z "$run" ; then 42 | echo "ERROR: You need to select -s (start) or -k (stop) " 43 | help_text 44 | fi 45 | if test -z "$PIRATEBOX_CONFIG" || test -z "$FIREWALL_CONFIG" ; then 46 | echo "ERROR: one of the config paths is empty, while it should not" 47 | help_text 48 | fi 49 | 50 | . "$PIRATEBOX_CONFIG" || exit 6 51 | . "$FIREWALL_CONFIG" || exit 5 52 | 53 | if [ "$run" = "start" ] ; then 54 | IPT_FLAG="-A" 55 | else 56 | IPT_FLAG="-D" 57 | fi 58 | 59 | if [ "$FIREWALL_FETCH_DNS" = "yes" ] ; then 60 | iptables -t nat $IPT_FLAG PREROUTING -i "$DNSMASQ_INTERFACE" -d 0/0 \ 61 | -p tcp --dport 53 -j DNAT --to-destination "${IP}:53" 62 | iptables -t nat $IPT_FLAG PREROUTING -i "$DNSMASQ_INTERFACE" -d 0/0 \ 63 | -p udp --dport 53 -j DNAT --to-destination "${IP}:53" 64 | fi 65 | 66 | if [ "$FIREWALL_FETCH_HTTP" = "yes" ] ; then 67 | iptables -t nat $IPT_FLAG PREROUTING -i "$DNSMASQ_INTERFACE" -d 0/0 \ 68 | -p tcp --dport 80 -j DNAT --to-destination "${IP}:80" 69 | fi 70 | 71 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/flush_dnsmasq.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # by Matthias Strubel , 2012 3 | # 4 | # Sends a SIGHUB to dnsmasq to reread its hosts files 5 | # Needed for mesh feature. Will enable easy dns-service for this. 6 | 7 | PIDFILE_DNSMASQ=/var/run/piratebox_dnsmasq.pid 8 | 9 | kill -1 `cat $PIDFILE_DNSMASQ` 10 | 11 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/generate_config_files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Matthias Strubel (c) 2013-2014 4 | # licenced with GPL-3 5 | # 6 | # Generate severall configuration files out of piratebox.conf 7 | # conf/hosts_generated 8 | # conf/dnsmasq_generated.conf 9 | # conf/radvd_generated.conf 10 | # conf/lighttpd/env 11 | # conf/hosts_mesh 12 | # 13 | # There are files for default configuration or adding custom stuff: 14 | # conf/hosts 15 | # conf/dnsmasq_default.conf 16 | # 17 | # it is using the following VARS out of piratebox.conf: 18 | # NET = The network of your box i.e. 192.168.1 19 | # IP_SHORT = The ip of the piratebox i.e. 1 results 192.168.1.1 20 | # START_LEASE = Range of dhcp leases start 10 21 | # END_LEASE = end 250 22 | # LEASE_DURATION = lease time 30min 23 | # HOSTNAME = piratebox.lan - o'rly? Maybe generate some additional stuff here 24 | # - 25 | # GLOBAL_CHAT = Enable Broadcasts 26 | # GLOBAL_DEST = Broadcast IP destinations 27 | # PYTHONPATH = Path of PirateBox python libs 28 | # GEN_CHATFILE = generated html chatfile 29 | # PIRATEBOX = PirateBox Folder 30 | # CHATFILE = data store for Shoutbox-content 31 | # 32 | # NODE_CONFIG = Config file for Mesh-Node parameters 33 | # - 34 | # ipv6.conf (loaded within piratebox.conf) 35 | # IPV6_ENABLE = enables IPv6 config 36 | # IPV6_ADVERT = which service for advertising IPv6 Prefix 37 | # IPV6_MASK = Netmask 38 | # IPV6_PREFIX = Which prefix should be announced. 39 | # - 40 | # node.conf 41 | # NODE_CONFIG_ACTIVE = if yes, configure special ipv6-node-hostname 42 | # NODE_IPV6_IP = Device specific IP 43 | # NODE_NAME & NODE_GEN = Settings for setting up Hostname 44 | # 45 | # Matthias Strubel -- 08.06.2012 46 | # licenced with GPL-3 47 | 48 | CONFIG_PATH="conf" 49 | DNSMASQ_CONFIG="" 50 | HOSTS_CONFIG="" 51 | DEFAULT_HOSTS="" 52 | LEASE_FILE="" 53 | RADVD_CONFIG="" 54 | LIGHTTPD_ENV_CONFIG="" 55 | AVAHI_SRC="" 56 | AVAHI_CONFIG="" 57 | 58 | set_pathnames() { 59 | CONFIG_PATH=$1/conf 60 | DNSMASQ_CONFIG=$CONFIG_PATH/dnsmasq_generated.conf 61 | HOSTS_CONFIG=$CONFIG_PATH/hosts_generated 62 | HOSTS_MESH=$CONFIG_PATH/hosts_mesh 63 | DEFAULT_HOSTS=$CONFIG_PATH/hosts 64 | DEFAULT_DNSMASQ=$CONFIG_PATH/dnsmasq_default.conf 65 | RADVD_CONFIG=$CONFIG_PATH/radvd_generated.conf 66 | LEASE_FILE=$LEASE_FILE_LOCATION 67 | LIGHTTPD_ENV_CONFIG=$CONFIG_PATH/lighttpd/env 68 | AVAHI_CONFIG=$CONFIG_PATH/avahi/avahi-daemon.conf 69 | AVAHI_SRC=$CONFIG_PATH/avahi/avahi-daemon.conf.schema 70 | 71 | } 72 | 73 | generate_hosts() { 74 | set_hostname=$1 75 | set_ipv4=$2 76 | set_ipv6=$3 77 | echo "Generating hosts file .... " 78 | cat $DEFAULT_HOSTS > $HOSTS_CONFIG 79 | echo "$set_ipv4 $set_hostname " >> $HOSTS_CONFIG 80 | echo "$set_ipv6 $set_hostname " >> $HOSTS_CONFIG 81 | 82 | } 83 | 84 | generate_dnsmasq() { 85 | net=$1 86 | lease_start=$3 87 | lease_end=$4 88 | lease_time=$5 89 | ip_pb=$2 90 | dnsmasq_interface=$6 91 | echo "Generating dnsmasq.conf ....." 92 | cat $DEFAULT_DNSMASQ > $DNSMASQ_CONFIG 93 | 94 | #Add interface line if filled 95 | [ -n $dnsmasq_interface ] && echo "interface=$dnsmasq_interface" >> $DNSMASQ_CONFIG 96 | 97 | lease_line="$net.$lease_start,$net.$lease_end,$lease_time" 98 | echo "dhcp-range=$lease_line" >> $DNSMASQ_CONFIG 99 | #redirect every dns 100 | dns_redirect="/#/$net.$ip_pb" 101 | echo "address=$dns_redirect" >> $DNSMASQ_CONFIG 102 | echo "dhcp-leasefile=$LEASE_FILE" >> $DNSMASQ_CONFIG 103 | 104 | echo "addn-hosts=$HOSTS_CONFIG" >>$DNSMASQ_CONFIG 105 | 106 | #Mesh hosts 107 | echo "addn-hosts=$HOSTS_MESH" >> $DNSMASQ_CONFIG 108 | 109 | if [ "$IPV6_ENABLE" = "yes" ] && [ "$IPV6_ADVERT" = "dnsmasq" ] ; then 110 | echo "Do additional v6 stuff in dnsmasq.conf" 111 | echo "#----- V6 Stuff" >> $DNSMASQ_CONFIG 112 | echo "dchp-range=$ipv6_call::, ra-stateless" >> $DNSMASQ_CONFIG 113 | fi 114 | 115 | } 116 | 117 | generate_radvd(){ 118 | prefix=$1 119 | mask=$2 120 | interface=$3 121 | 122 | echo "Generating config for radvd.." 123 | echo "#---- generated file ---" > $RADVD_CONFIG 124 | echo " 125 | interface $interface { 126 | AdvSendAdvert on; 127 | MinRtrAdvInterval 3; 128 | MaxRtrAdvInterval 10; 129 | prefix $prefix::/$mask { 130 | AdvOnLink on; 131 | AdvAutonomous on; 132 | AdvRouterAddr on; 133 | }; 134 | }; 135 | " >> $RADVD_CONFIG 136 | 137 | } 138 | 139 | #------------ lighttpd env config - Start --------------------- 140 | 141 | generate_lighttpd_env() { 142 | local GLOBAL_CHAT=$1 143 | local GLOBAL_DEST="$2" 144 | local PYTHONPATH=$3 145 | local SHOUTBOX_GEN_HTMLFILE=$4 146 | local PIRATEBOX=$5 147 | local SHOUTBOX_CHATFILE=$6 148 | local SHOUTBOX_CLIENT_TIMESTAMP=$7 149 | local IN_UPLOAD_PATH=$8 150 | local DISK_GEN_HTMLFILE=$9 151 | 152 | echo "Generating Environment-config for lighttpd ....." 153 | 154 | LIGHTTPD_ENV_BR_LINE="" 155 | if [ "$GLOBAL_CHAT" = "yes" ] ; then 156 | LIGHTTPD_ENV_BR_LINE=" \"SHOUTBOX_BROADCAST_DESTINATIONS\" => \"$GLOBAL_DEST\" , " 157 | fi 158 | 159 | LIGHTTPD_ENV="setenv.add-environment = ( 160 | \"PYTHONPATH\" => \"$PYTHONPATH:$PIRATEBOX/python_lib\", 161 | \"SHOUTBOX_GEN_HTMLFILE\" => \"$SHOUTBOX_GEN_HTMLFILE\" , 162 | \"SHOUTBOX_CHATFILE\" => \"$SHOUTBOX_CHATFILE\" , 163 | \"SHOUTBOX_CLIENT_TIMESTAMP\" => \"$SHOUTBOX_CLIENT_TIMESTAMP\" , 164 | \"UPLOAD_PATH\" => \"$IN_UPLOAD_PATH\" , 165 | \"DISK_GEN_HTMLFILE\" => \"$DISK_GEN_HTMLFILE\" , 166 | $LIGHTTPD_ENV_BR_LINE 167 | 168 | )" 169 | 170 | echo $LIGHTTPD_ENV > $LIGHTTPD_ENV_CONFIG 171 | } 172 | 173 | #------------ lighttpd env config - End --------------------- 174 | 175 | 176 | 177 | if [ -z $1 ] ; then 178 | echo "Usage is 179 | generate_config_files.sh /opt/piratebox/conf/piratebox.conf 180 | " 181 | exit 255 182 | fi 183 | 184 | if [ ! -f $1 ] ; then 185 | echo "Config-File $1 not found..." 186 | exit 255 187 | fi 188 | 189 | . $1 190 | 191 | . $NODE_CONFIG 192 | . $PIRATEBOX_FOLDER/lib/node_name_generation.sh 193 | 194 | IPV6="#" 195 | 196 | set_pathnames $PIRATEBOX_FOLDER 197 | 198 | ipv6_call='' 199 | if [ "$IPV6_ENABLE" = "yes" ] ; then 200 | ipv6_call=$IPV6_PREFIX 201 | IPV6=$IPV6_IP 202 | [[ "$IPV6_ADVERT" = "radvd" ]] && generate_radvd $IPV6_PREFIX $IPV6_MASK $DNSMASQ_INTERFACE 203 | fi 204 | generate_hosts $HOST $IP $IPV6 205 | generate_dnsmasq $NET $IP_SHORT $START_LEASE $END_LEASE $LEASE_DURATION $DNSMASQ_INTERFACE 206 | generate_lighttpd_env $GLOBAL_CHAT "$GLOBAL_DEST" $PIRATEBOX_PYTHONPATH $GEN_CHATFILE $PIRATEBOX_FOLDER $CHATFILE $SHOUTBOX_CLIENT_TIMESTAMP $UPLOADFOLDER $GEN_DISKFILE 207 | 208 | COMPLETE_HOST=$HOST 209 | 210 | if [ "$NODE_CONFIG_ACTIVE" = "yes" ] ; then 211 | echo -n "Appending local node-name hosts entry " 212 | if generate_node_name "$HOST" "$NODE_NAME" "$NODE_GEN" ; then 213 | echo $NODE_GEN_OUTPUT 214 | echo "$NODE_IPV6_IP $NODE_GEN_OUTPUT " >> $HOSTS_CONFIG 215 | COMPLETE_HOST=$NODE_GEN_OUTPUT 216 | else 217 | echo "Error: No valid node-name-config found, skipping" 218 | fi 219 | fi 220 | 221 | #We want a long hostname and not only the hostname itself... 222 | ### PirateBox Scripts generates its own config in /opt/piratebox/conf/avahi 223 | ### but, the daemon works per default only on /etc/avahi 224 | ### If you want to enable avahi, then you have to link /etc/avahi to /opt/piratebox/conf/avahi 225 | ### On OpenWRT this should happen, if avahi is available before installing the piratebox 226 | ### automtically. 227 | AVAHI_HOST=$( echo $COMPLETE_HOST | sed 's|\.|_|g' ) 228 | sed "s|#####MASKED_HOSTNAME#####|$AVAHI_HOST|" $AVAHI_SRC > $AVAHI_CONFIG 229 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/hooks/hook_piratebox_start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # ---- TEMPLATE ---- 4 | 5 | # Runs on every Startup 6 | # get config file 7 | 8 | if [ ! -f $1 ] ; then 9 | echo "Config-File $1 not found..." 10 | exit 255 11 | fi 12 | 13 | #Load config 14 | . $1 15 | 16 | # You can uncommend this line to see when hook is starting: 17 | # echo "------------------ Running $0 ------------------" 18 | 19 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/hooks/hook_piratebox_start_done.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # ---- TEMPLATE ---- 4 | 5 | # Runs on every Startup after the normal init-steps are done 6 | # get config file 7 | 8 | if [ ! -f $1 ] ; then 9 | echo "Config-File $1 not found..." 10 | exit 255 11 | fi 12 | 13 | #Load config 14 | . $1 15 | 16 | # You can uncommend this line to see when hook is starting: 17 | # echo "------------------ Running $0 ------------------" 18 | 19 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/hooks/hook_piratebox_stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # ---- TEMPLATE ---- 4 | 5 | # Runs on every Stop before anything is stopped 6 | # get config file 7 | 8 | if [ ! -f $1 ] ; then 9 | echo "Config-File $1 not found..." 10 | exit 255 11 | fi 12 | 13 | #Load config 14 | . $1 15 | 16 | # You can uncommend this line to see when hook is starting: 17 | # echo "------------------ Running $0 ------------------" 18 | 19 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/hooks/hook_piratebox_stop_done.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # ---- TEMPLATE ---- 4 | 5 | # Rund after every stop command is processed 6 | # get config file 7 | 8 | if [ ! -f $1 ] ; then 9 | echo "Config-File $1 not found..." 10 | exit 255 11 | fi 12 | 13 | #Load config 14 | . $1 15 | 16 | # You can uncommend this line to see when hook is starting: 17 | # echo "------------------ Running $0 ------------------" 18 | 19 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/hooks/hook_post_init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # ---- TEMPLATE ---- 4 | 5 | # Hook for modifcation stuff right after 6 | # piratebox/bin/install ... part2 7 | # is run. 8 | 9 | if [ ! -f $1 ] ; then 10 | echo "Config-File $1 not found..." 11 | exit 255 12 | fi 13 | 14 | #Load config 15 | . $1 16 | 17 | # You can uncommend this line to see when hook is starting: 18 | # echo "------------------ Running $0 ------------------" 19 | 20 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/hooks/hook_pre_init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # ---- TEMPLATE ---- 4 | 5 | # Hook for modifcation stuff before 6 | # piratebox/bin/install ... part2 7 | # is run. 8 | 9 | if [ ! -f $1 ] ; then 10 | echo "Config-File $1 not found..." 11 | exit 255 12 | fi 13 | 14 | #Load config 15 | . $1 16 | 17 | # You can uncommend this line to see when hook is starting: 18 | # echo "------------------ Running $0 ------------------" 19 | 20 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/hooks/hook_pre_openwrt_init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # ---- TEMPLATE ---- 4 | 5 | # Hook for modifcation stuff before 6 | # piratebox/bin/install ... openwrt 7 | # is started 8 | 9 | 10 | if [ ! -f $1 ] ; then 11 | echo "Config-File $1 not found..." 12 | exit 255 13 | fi 14 | 15 | #Load config 16 | . $1 17 | 18 | #Load openwrt-common config and procedures file! 19 | . /etc/piratebox.config 20 | 21 | 22 | # You can uncommend this line to see when hook is starting: 23 | # echo "------------------ Running $0 ------------------" 24 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/install_piratebox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ## PirateBox installer script 3 | ## created by Matthias Strubel (c)2011-2014 GPL-3 4 | ## 5 | 6 | create_content_folder(){ 7 | 8 | echo "Creating 'content' folder on USB stick and move over stuff" 9 | mkdir -p $WWW_CONTENT 10 | cp -r $PIRATEBOX_FOLDER/www_content/* $WWW_CONTENT 11 | 12 | [ ! -L $PIRATEBOX_FOLDER/www/content ] && \ 13 | ln -s $WWW_CONTENT $WWW_FOLDER/content 14 | [ ! -e $WWW_FOLDER/favicon.ico ] && \ 15 | ln -s $WWW_CONTENT/favicon.ico $WWW_FOLDER 16 | 17 | chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $WWW_CONTENT -R 18 | chmod u+rw $WWW_CONTENT 19 | return 0 20 | } 21 | 22 | # Load configfile 23 | 24 | if [ -z $1 ] || [ -z $2 ]; then 25 | echo "Usage install_piratebox my_config " 26 | echo " Parts: " 27 | echo " part2 : sets Permissions and links correctly" 28 | echo " imageboard : configures kareha imageboard with Basic configuration" 29 | echo " should be installed in /share/board" 30 | echo " pyForum : Simple PythonForum" 31 | echo " station_cnt : Adds Statio counter to your Box - crontab entry" 32 | echo " flush_dns_reg : Installs crontask to flush dnsmasq regulary" 33 | echo " hostname 'name' : Exchanges the Hostname displayed in browser" 34 | exit 1 35 | fi 36 | 37 | 38 | if [ ! -f $1 ] ; then 39 | echo "Config-File $1 not found..." 40 | exit 1 41 | fi 42 | 43 | #Load config 44 | PIRATEBOX_CONFIG=$1 45 | . $1 46 | 47 | if [ $2 = 'pyForum' ] ; then 48 | cp -v $PIRATEBOX_FOLDER/src/forest.py $WWW_FOLDER/cgi-bin 49 | cp -v $PIRATEBOX_FOLDER/src/forest.css $WWW_FOLDER/content/css 50 | mkdir -p $PIRATEBOX_FOLDER/forumspace 51 | chmod a+rw -R $PIRATEBOX_FOLDER/forumspace 2> /dev/null 52 | chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $WWW_FOLDER/cgi-bin/forest.py 53 | chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $WWW_FOLDER/content/forest.css 2> /dev/null 54 | echo "Copied the files. Recheck your PirateBox now. " 55 | fi 56 | 57 | 58 | 59 | if [ $2 = 'part2' ] ; then 60 | echo "Starting initialize PirateBox Part2.." 61 | #Create directories 62 | # mkdir -p $PIRATEBOX_FOLDER/share/Shared 63 | mkdir -p $UPLOADFOLDER 64 | mkdir -p $PIRATEBOX_FOLDER/share/board 65 | mkdir -p $PIRATEBOX_FOLDER/share/tmp 66 | mkdir -p $PIRATEBOX_FOLDER/tmp 67 | 68 | #Distribute the Directory Listing files 69 | if [ "$CUSTOM_DIRLIST_COPY" = "yes" ] ; then 70 | $PIRATEBOX_FOLDER/bin/distribute_files.sh $SHARE_FOLDER/Shared true 71 | fi 72 | #Set permissions 73 | chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $PIRATEBOX_FOLDER/share -R 74 | chmod u+rw $PIRATEBOX_FOLDER/share 75 | chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $PIRATEBOX_FOLDER/www -R 76 | chmod u+x $PIRATEBOX_FOLDER/www/cgi-bin/* 77 | chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $PIRATEBOX_FOLDER/tmp 78 | chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $PIRATEBOX_FOLDER/tmp -R 79 | 80 | 81 | #Install a small script, that the link on the main page still works 82 | if [ ! -f $PIRATEBOX_FOLDER/share/board/kareha.pl ] ; then 83 | cp $PIRATEBOX_FOLDER/src/kareha.pl $PIRATEBOX_FOLDER/share/board 84 | fi 85 | 86 | [ ! -L $PIRATEBOX_FOLDER/www/board ] && ln -s $PIRATEBOX_FOLDER/share/board $PIRATEBOX_FOLDER/www/board 87 | [ ! -L $PIRATEBOX_FOLDER/www/Shared ] && ln -s $UPLOADFOLDER $PIRATEBOX_FOLDER/www/Shared 88 | [ ! -L $PIRATEBOX_FOLDER/www/content ] && \ 89 | ln -s $WWW_CONTENT $WWW_FOLDER/content 90 | 91 | fi 92 | 93 | #Install the image-board 94 | if [ $2 = 'imageboard' ] ; then 95 | 96 | if [ -e $PIRATEBOX_FOLDER/share/board/init_done ] ; then 97 | echo "$PIRATEBOX_FOLDER/share/board/init_done file Found in Kareha folder. Won't reinstall board." 98 | exit 0; 99 | fi 100 | 101 | 102 | cd $PIRATEBOX_FOLDER/tmp 103 | KAREHA_RELEASE=kareha_3.1.4.zip 104 | if [ ! -e $PIRATEBOX_FOLDER/tmp/$KAREHA_RELEASE ] ; then 105 | echo " Wgetting kareha-zip file " 106 | wget http://wakaba.c3.cx/releases/Kareha/$KAREHA_RELEASE 107 | if [ "$?" != "0" ] ; then 108 | echo "wget kareha failed.. you can place the current file your to $PIRATEBOX_FOLDER/tmp " 109 | fi 110 | fi 111 | 112 | if [ -e $PIRATEBOX_FOLDER/tmp/$KAREHA_RELEASE ] ; then 113 | echo "Kareha Zip found..." 114 | else 115 | echo "No Zip found, abort " 116 | exit 255 117 | fi 118 | 119 | unzip $KAREHA_RELEASE 120 | mv kareha/* $PIRATEBOX_FOLDER/share/board 121 | rm -rf $PIRATEBOX_FOLDER/tmp/kareha* 122 | 123 | cd $PIRATEBOX_FOLDER/share/board 124 | cp -R mode_image/* ./ 125 | cp $PIRATEBOX_FOLDER/src/kareha_img_config.pl $PIRATEBOX_FOLDER/share/board/config.pl 126 | cp $PIRATEBOX_FOLDER/src/no_forum.html $PIRATEBOX_FOLDER/share/board/index.htm 127 | chown -R $LIGHTTPD_USER:$LIGHTTPD_GROUP $PIRATEBOX_FOLDER/share/board 128 | #Install filetype thumbnails 129 | mv $PIRATEBOX_FOLDER/share/board/extras/icons $PIRATEBOX_FOLDER/share/board/ 130 | 131 | echo "Errors in chown occurs if you are using vfat on the USB stick" 132 | echo " . don't Panic!" 133 | echo "Generating index page" 134 | cd /tmp 135 | wget -q http://127.0.0.1/board/kareha.pl 136 | echo "finished!" 137 | echo "Now Edit your kareha settings file to change your ADMIN_PASS and SECRET : " 138 | echo " # vi $PIRATEBOX_FOLDER/www/board/config.pl " 139 | 140 | touch $PIRATEBOX_FOLDER/share/board/init_done 141 | fi 142 | 143 | if [ $2 = "station_cnt" ] ; then 144 | #we want to append the crontab, not overwrite 145 | crontab -l > $PIRATEBOX_FOLDER/tmp/crontab 2> /dev/null 146 | echo "#--- Crontab for PirateBox-Station-Cnt" >> $PIRATEBOX_FOLDER/tmp/crontab 147 | echo " */2 * * * * $PIRATEBOX_FOLDER/bin/station_cnt.sh > $WWW_FOLDER/station_cnt.txt " >> $PIRATEBOX_FOLDER/tmp/crontab 148 | crontab $PIRATEBOX_FOLDER/tmp/crontab 149 | [ "$?" != "0" ] && echo "an error occured" && exit 254 150 | $PIRATEBOX_FOLDER/bin/station_cnt.sh > $WWW_FOLDER/station_cnt.txt 151 | echo "installed, now every 2 minutes your station count is refreshed" 152 | fi 153 | 154 | if [ $2 = "flush_dns_reg" ] ; then 155 | crontab -l > $PIRATEBOX_FOLDER/tmp/crontab 2> /dev/null 156 | echo "#--- Crontab for dnsmasq flush" >> $PIRATEBOX_FOLDER/tmp/crontab 157 | echo " */2 * * * * $PIRATEBOX_FOLDER/bin/flush_dnsmasq.sh > $PIRATEBOX_FOLDER/tmp/dnsmasq_flush.log " >> $PIRATEBOX_FOLDER/tmp/crontab 158 | crontab $PIRATEBOX_FOLDER/tmp/crontab 159 | [ "$?" != "0" ] && echo "an error occured" && exit 254 160 | echo "Installed crontab for flushing dnsmasq requlary" 161 | fi 162 | 163 | set_hostname() { 164 | local name=$1 ; shift; 165 | 166 | sed "s|#####HOST#####|$name|g" $PIRATEBOX_FOLDER/src/redirect.html.schema > $WWW_FOLDER/index.html 167 | sed "s|HOST=\"$HOST\"|HOST=\"$name\"|" -i $PIRATEBOX_CONFIG 168 | } 169 | 170 | if [ $2 = "hostname" ] ; then 171 | echo "Switching hostname to $3" 172 | set_hostname "$3" 173 | echo "..done" 174 | fi 175 | 176 | if [ $2 = "content" ] ; then 177 | create_content_folder 178 | fi 179 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/json_generation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Matthias Strubel (c) 2013 - GPL3 4 | # Generate a JSON file, which relfects some part of the current configuration 5 | 6 | # First parameter is the piratebox.conf 7 | ### Used parameter : JSON_FILE 8 | 9 | . $1 10 | 11 | # json.conf contains some information about modules on the frontend 12 | . $PIRATEBOX_FOLDER/conf/json.conf 13 | 14 | ### JSON convert functions 15 | . $PIRATEBOX_FOLDER/lib/json_func.sh 16 | 17 | JSON_FILE=$PBX_JSON_FILE 18 | 19 | #### 20 | # DROOPY_ENABLED => upload_droopy 21 | # DROOPY_PORT => droopy_port 22 | # HOST => droopy_host 23 | 24 | json_droopy_enabled=`convert_yn_to_tf $DROOPY_ENABLED` 25 | json_shoutbox_enabled=`convert_yn_to_tf $SHOUTBOX_ENABLED` 26 | 27 | echo "Generating json configuration file: $JSON_FILE" 28 | 29 | echo "" > $PBX_JSON_FILE 30 | echo "{ \"piratebox\" : { \"module\" : { " >> $JSON_FILE 31 | #------------ upload configuration 32 | echo -n " \"upload\" : { \"status\" : $json_droopy_enabled , \"file\" : \"$UPLOAD_MODULE_FILE\" " >> $JSON_FILE 33 | #----------- droopy specialities 34 | if [ "$DROOPY_ENABLED" = "yes" ] ; then 35 | echo -n ", " >> $JSON_FILE 36 | echo -n " \"upload_style\" : \"droopy\" , " >> $JSON_FILE 37 | echo -n " \"droopy_port\" : \"$DROOPY_PORT\", \"droopy_host\" : \"$HOST\" " >> $JSON_FILE 38 | fi 39 | echo " } " >> $JSON_FILE 40 | 41 | #--------------- Shoutbox config file 42 | echo ", \"shoutbox\" : { \"status\" : $json_shoutbox_enabled , \"file\" : \"$CHAT_MODULE_FILE\" } " >> $JSON_FILE 43 | 44 | #--------------- 45 | echo ", \"version\" : \""$(cat $PIRATEBOX_FOLDER/version )"\"" >> $JSON_FILE 46 | echo " } } }" >> $JSON_FILE 47 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/piratebox_setup_wlan.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Matthias Strubel (c) 2011-2014 GPL-3 4 | # Script for setting up the wlan interface 5 | # Parameter 1 i used for the config file providing the parameters 6 | 7 | # IP-Adress IPv4 + IPv6 8 | # Netmask 9 | # Interface 10 | 11 | probe() { 12 | if [ "$PROBE_INTERFACE" = "yes" ] ; then 13 | echo -n "Probing interface $INTERFACE" 14 | ifconfig "$INTERFACE" >> /dev/null 2>&1 15 | TEST_OK=$? 16 | CNT=$PROBE_TIME 17 | while [[ "$TEST_OK" != "0" && "$CNT" != "0" ]] 18 | do 19 | echo -n "." 20 | sleep 1 21 | CNT=$(( $CNT - 1 )) 22 | if [ "$CNT" = 0 ] ; then 23 | exit 99 24 | fi 25 | ifconfig "$INTERFACE" >> /dev/null 2>&1 26 | TEST_OK=$? 27 | done 28 | fi 29 | } 30 | 31 | 32 | 33 | # Load configfile 34 | 35 | if [ -z $1 ] || [ -z $2 ]; then 36 | echo "Usage piratebox_setup_wlan.sh my_config " 37 | exit 1 38 | fi 39 | 40 | 41 | if [ ! -f $1 ] ; then 42 | echo "Config-File $1 not found..." 43 | exit 1 44 | fi 45 | 46 | #Load config 47 | . $1 48 | 49 | 50 | ### Check config 51 | if [ -z $INTERFACE ]; then 52 | echo "Please define i.e. " 53 | echo " INTERFACE=wlan0 " 54 | exit 1 55 | fi 56 | 57 | if [ -z $IP ] ; then 58 | echo "Please define i.e. " 59 | echo " IP=192.268.46.2 " 60 | exit 1 61 | fi 62 | 63 | if [ -z $NETMASK ] ; then 64 | echo "Please define i.e. " 65 | echo " NETMASK=255.255.255.0 " 66 | exit 1 67 | fi 68 | 69 | 70 | 71 | ### Do the stuff 72 | 73 | if [ $2 = "start" ] ; then 74 | 75 | echo "Bringing up wifi interface $INTERFACE " 76 | ifconfig $INTERFACE up 77 | 78 | if [ $? -ne 0 ] ; then 79 | echo "..failed "; 80 | exit 1 81 | fi 82 | 83 | echo "Setting up $INTERFACE" 84 | ifconfig $INTERFACE $IP netmask $NETMASK 85 | 86 | if [ $? -ne 0 ] ; then 87 | echo "..failed "; 88 | exit 1 89 | fi 90 | 91 | if [ $IPV6_ENABLE = "yes" ] ; then 92 | echo "Setting up IPv6 stuff" 93 | IPv6="$IPV6_IP"/"$IPV6_MASK" 94 | echo " $INTERFACE -->$IPv6<--" 95 | ifconfig $INTERFACE add $IPv6 96 | #That ip is a local IP only 97 | ip addr change $IPv6 dev $INTERFACE scope link 98 | fi 99 | 100 | . $NODE_CONFIG 101 | 102 | if [ "$NODE_CONFIG_ACTIVE" == "yes" ] && [ "$NODE_IPV6_SET_IP" == "yes" ]; then 103 | echo "Setting up IPv6 Mesh-Node IP on interface $NODE_INTERFACE" 104 | ifconfig $NODE_INTERFACE add $NODE_IPV6_IP"$NODE_IPV6_MASK" 105 | fi 106 | 107 | elif [ $2 = "stop" ] ; then 108 | echo "Stopping wifi interface $INTERFACE " 109 | ifconfig $INTERFACE down 110 | 111 | if [ "$NODE_CONFIG_ACTIVE" == "yes" ] && [ "$NODE_IPV6_SET_IP" == "yes" ] ; then 112 | echo "Removing the Node-Address again..." 113 | ifconfig $NODE_INTERFACE del $NODE_IPV6_IP"$NODE_IPV6_MASK" 114 | fi 115 | elif [ $2 = "probe" ] ; then 116 | # simply check if the interface is available 117 | probe 118 | fi 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/rpi_hwclock.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This small shell script initializes the I2C bus on a Raspberry Pi 3 | # and activates an installed real time clock module. 4 | # Afterwards the system time is synced to the hardware clock. 5 | 6 | echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device 7 | hwclock -s 8 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/shoutbox_daemon.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Starts deamon for global shoutbox service 4 | # requires piratebox.conf as first parameter 5 | # 6 | # Matthias Strubel - 2012-2014 7 | # Licenced with GPL-3 8 | 9 | . $1 10 | 11 | cd $PIRATEBOX_FOLDER 12 | cd python_lib 13 | 14 | export SHOUTBOX_CHATFILE=$CHATFILE 15 | export SHOUTBOX_GEN_HTMLFILE=$GEN_CHATFILE 16 | 17 | 18 | if [ "$GLOBAL_CHAT" = "yes" ] ; then 19 | export SHOUTBOX_BROADCAST_DESTINATIONS="$GLOBAL_DEST" 20 | fi 21 | 22 | exec python discover.py 23 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/shoutbox_stuff.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Matthias Strubel - (c)2012-2014 with GPL-3 4 | # 5 | # Only calls generate-Routing in piratebox-folder 6 | # gets Piratebox-Folder into www 7 | 8 | 9 | # $1 www folder 10 | # $2 pirtatebox config file 11 | 12 | 13 | . $2 14 | 15 | 16 | cd $PIRATEBOX_FOLDER 17 | cd python_lib 18 | 19 | export SHOUTBOX_CHATFILE=$CHATFILE 20 | export SHOUTBOX_GEN_HTMLFILE=$GEN_CHATFILE 21 | export SHOUTBOX_CLIENT_TIMESTAMP=$SHOUTBOX_CLIENT_TIMESTAMP 22 | 23 | export DISK_GEN_HTMLFILE=$GEN_DISKFILE 24 | 25 | #Writing init-message and reset chat.. 26 | if [ "$RESET_CHAT" = "yes" ] ; then 27 | cat $PIRATEBOX_FOLDER/conf/chat_init.txt > $CHATFILE 28 | fi 29 | 30 | #Generate content file for Shoutbox 31 | python psogen.py generate 32 | 33 | if [ "$SHOUTBOX_ENABLED" = "no" ] ; then 34 | # If the shoutbox is disabled, we remove the writable flag 35 | echo -n "Making shoutbox readonly..." 36 | chmod a-w $CHATFILE 37 | echo "done" 38 | fi 39 | 40 | #Generate content file for DiskUsage 41 | python diskusage.py generate 42 | 43 | $( sleep 20 && touch $GEN_CHATFILE ) & 44 | 45 | #Set correct permissions 46 | chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $SHOUTBOX_CHATFILE 47 | chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $SHOUTBOX_GEN_HTMLFILE 48 | chmod ug+rw $SHOUTBOX_CHATFILE 49 | chmod ug+rw $SHOUTBOX_GEN_HTMLFILE 50 | 51 | #DiskUsage correct permissions 52 | chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $DISK_GEN_HTMLFILE 53 | chmod ug+rw $DISK_GEN_HTMLFILE 54 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/station_cnt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## By Matthias Strubel , Licenced by GPL-3 (c)2012-2014 4 | 5 | CNT=`iw wlan0 station dump | grep Station | wc -l` 6 | #DATE=`date` 7 | #echo $DATE - $CNT 8 | echo "Currently there are $CNT connected clients" 9 | -------------------------------------------------------------------------------- /piratebox/piratebox/bin/timesave.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script enables a sort of timerescue System 4 | # for Systems without a Realtime Clock 5 | # like TP-Link MR3020 , RaspberryPI 6 | # 7 | # It does not reflect the real time, but 8 | # gives a sort of stability to complete standalone 9 | # systems. 10 | # 11 | # Licenced under GPL-3 @ 2012,2015 12 | # Matthias Strubel matthias.strubel@aod-rgp.de 13 | 14 | ##function for similar saving & getting time 15 | get_datetime() { 16 | # Get format from piratebox.conf 17 | date "${TIMESAVE_FORMAT}" 18 | } 19 | 20 | # Strip spaces from datetime 21 | sanitize_datetime() { 22 | echo "$1" | sed s/" "/""/g 23 | } 24 | 25 | # Print usage if parameters are not provided 26 | if [ -z "$1" ] || [ -z "$2" ] ; then 27 | echo "Set up a crontab entry for regulary saving the time" 28 | echo "Usage $0 " 29 | echo " Valid steps are:" 30 | echo " install - installs the needed parts into crontab" 31 | echo " save - saves time into file" 32 | echo " recover - recovers the time from a file" 33 | 34 | exit 1 35 | fi 36 | 37 | # Load configfile 38 | . "$1" 39 | 40 | if [ "$2" = "install" ] ; then 41 | crontab -l > $PIRATEBOX_FOLDER/tmp/crontab 2> /dev/null 42 | echo "#--- Crontab for PirateBox-Timesave" >> $PIRATEBOX_FOLDER/tmp/crontab 43 | echo " */5 * * * * $PIRATEBOX_FOLDER/bin/timesave.sh $PIRATEBOX_FOLDER/conf/piratebox.conf save" >> $PIRATEBOX_FOLDER/tmp/crontab 44 | crontab $PIRATEBOX_FOLDER/tmp/crontab 45 | 46 | echo "initialize timesave file" 47 | touch "$TIMESAVE" 48 | chmod a+rw "$TIMESAVE" 49 | get_datetime > "$TIMESAVE" 50 | 51 | echo "Remember MAY have to cron active..." 52 | echo " on OpenWrt run: /etc/init.d/piratebox enable" 53 | 54 | exit 0 55 | fi 56 | 57 | # Save current date-time in a recoverable format 58 | if [ "$2" = "save" ] ; then 59 | if [ -e "$TIMESAVE" ] ; then 60 | if [ $(sanitize_datetime "$(get_datetime)") -lt $(sanitize_datetime "$(cat $TIMESAVE)") ] ; then 61 | logger -s "$0: Current date-time is lower then saved one. Not saving!" 62 | exit 1 63 | fi 64 | fi 65 | 66 | get_datetime > "$TIMESAVE" 67 | exit 0 68 | fi 69 | 70 | # Recover date-time from a previous state 71 | if [ "$2" = "recover" ] ; then 72 | if [ $(sanitize_datetime "$(get_datetime)") -lt $(sanitize_datetime "$(cat $TIMESAVE)") ] ; then 73 | date -s "$(cat $TIMESAVE)" > /dev/null 74 | if [ "$?" != "0" ] ; then 75 | logger -s "$0: Could not recover date-time." 76 | exit 1 77 | else 78 | logger -s "$0: Sucessfully recovered date-time." 79 | exit 0 80 | fi 81 | else 82 | logger -s "$0: Time can not be changed to the past." 83 | exit 1 84 | fi 85 | fi 86 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/avahi/avahi-daemon.conf.schema: -------------------------------------------------------------------------------- 1 | [server] 2 | host-name=#####MASKED_HOSTNAME##### 3 | use-ipv4=no 4 | use-ipv6=yes 5 | check-response-ttl=no 6 | use-iff-running=no 7 | 8 | 9 | [publish] 10 | publish-addresses=yes 11 | publish-hinfo=yes 12 | publish-workstation=no 13 | publish-domain=yes 14 | 15 | 16 | [reflector] 17 | enable-reflector=no 18 | reflect-ipv=no 19 | 20 | [rlimits] 21 | #rlimit-as= 22 | rlimit-core=0 23 | rlimit-data=4194304 24 | rlimit-fsize=0 25 | rlimit-nofile=30 26 | rlimit-stack=4194304 27 | rlimit-nproc=3 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/avahi/services/http.service: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Web Server on %h 5 | 6 | _http._tcp 7 | 80 8 | path=/ 9 | 10 | 11 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/avahi/services/ssh.service: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | 25 | 26 | 27 | %h 28 | 29 | 30 | _ssh._tcp 31 | 22 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/chat_init.txt: -------------------------------------------------------------------------------- 1 |
00:00:00 PirateBox: Chat and share files anonymously!
2 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/dnsmasq_default.conf: -------------------------------------------------------------------------------- 1 | #dont use resolv.conf 2 | no-resolv 3 | #dont recheck resolv.conf for changes 4 | no-poll 5 | 6 | #overwrite dns.. 7 | #dhcp-authoritative 8 | 9 | # If you don't want dnsmasq to read /etc/hosts, uncomment the 10 | # following line. 11 | no-hosts 12 | # or if you want it to read another file, as well as /etc/hosts, use 13 | # this. 14 | #addn-hosts=/etc/banner_add_hosts 15 | ## ^^^^^^ <- generated 16 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/firewall.conf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Configuration file for PirateBox firewall configuration 4 | # 5 | 6 | # Collect all incoming DNS requests, even these are not addressed 7 | # to this machine. 8 | FIREWALL_FETCH_DNS="yes" 9 | 10 | # Collect all incoming Port 80 request, even these should be 11 | # relayed to a different machine 12 | FIREWALL_FETCH_HTTP="no" 13 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/hook_custom.conf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Place your custom variables down here. 4 | # Will be loaded into piratebox.conf via runtime 5 | 6 | #VAR1="CONTENT" 7 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/hostapd.conf: -------------------------------------------------------------------------------- 1 | interface=wlan0 2 | driver=nl80211 3 | ssid=PirateBox - Share Freely 4 | 5 | channel=1 6 | #auth_algs=1 7 | 8 | # Remove # to enable n wifi mode 9 | #ieee80211n=1 10 | #wmm_enabled=1 11 | #ht_capab=[HT40+][SHORT-GI-40][DSSS_CCK-40] 12 | hw_mode=g 13 | 14 | # Put a # in front of the following line to allow 15 | # direct client 2 client communication 16 | ap_isolate=1 17 | 18 | # Uncomment the following lines to enable WPA 19 | #wpa=2 20 | #wpa_key_mgmt=WPA-PSK 21 | #wpa_pairwise=TKIP CCMP 22 | #rsn_pairwise=CCMP 23 | #wpa_passphrase=Somepassphrase 24 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/hosts: -------------------------------------------------------------------------------- 1 | #------ Static 2 | 3 | # Entry for tricking windows 4 | ### commented because this will cause the default redirect. 5 | ### left here for documentary the stuff 6 | ### dns.msftncsi.com 131.107.255.255 7 | #------- Static end ... Generated stuff now 8 | 9 | 10 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/hosts_mesh: -------------------------------------------------------------------------------- 1 | #-------------------- 2 | # Spacer for generated hostsfile from mesh detection 3 | #-------------------- 4 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/ipv6.conf: -------------------------------------------------------------------------------- 1 | ####-------------- 2 | # Config file will be filled up partly on init-step 3 | ####-------------- 4 | 5 | #Enable IPv6 Setup (yes|no) on you interface 6 | IPV6_ENABLE="no" 7 | 8 | # Which kind of router-adverticement should be used ( radvd | dnsmasq | none ) 9 | # 10 | IPV6_ADVERT="radvd" 11 | 12 | #absolute Node-Adress 13 | IPV6_IP="fdc0:ffea::1" 14 | 15 | #Netmask without / 16 | IPV6_MASK="64" 17 | 18 | # Prefix to piratebox ipv6 adress 19 | IPV6_PREFIX="fdc0:ffea" 20 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/irc.conf: -------------------------------------------------------------------------------- 1 | ### Configuration file for mniircd server 2 | 3 | 4 | IRC_CONFIG_FOLDER=$PIRATEBOX_FOLDER/conf/irc 5 | 6 | #Save state ; keeps topic config. Enable with removing # 7 | #IRC_STATEDIR=$IRC_CONFIG_FOLDER/state 8 | 9 | #MOTD Message 10 | IRC_MOTD=$IRC_CONFIG_FOLDER/motd.txt 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/irc/motd.txt: -------------------------------------------------------------------------------- 1 | Welcome to PirateBox IRC! 2 | 3 | Inspired by pirate radio and the free culture movement, PirateBox is a DIY anonymous offline file-sharing and communications system. PirateBox creates offline wireless networks designed for anonymous file sharing, chatting, message boarding, and media streaming. You can think of it as your very own portable offline Internet in a box! 4 | 5 | PirateBox is designed to be safe and secure. No logins are required and no user data is logged. The system is purposely not connected to the Internet in order to prevent tracking and preserve user privacy. 6 | 7 | PirateBox was created by David Darts and the Lead Developer is Matthias Strubel. The project is licensed under the GPLv3. To learn more about the project or to find out how to build your own PirateBox, please visit http://piratebox.cc 8 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/json.conf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ### 3 | # This file contains some valid informations for the content 4 | ## 5 | 6 | 7 | CHAT_MODULE_FILE="modules/chat.html" 8 | UPLOAD_MODULE_FILE="modules/upload.html" 9 | 10 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/lighttpd/env: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PirateBox-Dev/PirateBoxScripts_Webserver/25621d780cc27df4ca5b647a303332709c3aa2ab/piratebox/piratebox/conf/lighttpd/env -------------------------------------------------------------------------------- /piratebox/piratebox/conf/lighttpd/fastcgi-php-generate203.conf: -------------------------------------------------------------------------------- 1 | #-------------------- FAST CGI stuff 2 | 3 | # Run a specific php script when the URL /generate_204 is requested. 4 | # Android clients request this URL to check for a full working 5 | # internet connection, we want to fake a reply. This config section is 6 | # a hack to make a php script without the ".php" extension work when 7 | # mod_rewrite is not available. 8 | $HTTP["url"] =~ "^/generate_204$" { 9 | fastcgi.server = ( 10 | "" => (( 11 | "bin-path" => "/usr/bin/php-cgi", 12 | "socket" => "/tmp/php.socket", 13 | "max-procs" => 1 14 | )) 15 | ) 16 | } 17 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/lighttpd/fastcgi-php.conf: -------------------------------------------------------------------------------- 1 | #-------------------- FAST CGI stuff 2 | 3 | $HTTP["url"] =~ "^/content/" { 4 | fastcgi.server = ( 5 | ".php" => (( 6 | "bin-path" => "/usr/bin/php-cgi", 7 | "socket" => "/tmp/php.socket", 8 | "max-procs" => 1 9 | )) 10 | ) 11 | } 12 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/lighttpd/lighttpd.conf: -------------------------------------------------------------------------------- 1 | ## Configuration for Piratebox 2 | 3 | server.modules = ( 4 | # "mod_access", not needed! 5 | "mod_alias", 6 | # "mod_compress", Disabled, fixing reload Problem?? 7 | "mod_redirect", 8 | # "mod_rewrite", 9 | "mod_setenv", 10 | "mod_fastcgi" 11 | ) 12 | 13 | server.document-root = "/opt/piratebox/www" 14 | 15 | ## Locate the tmp storage into tmp. It is in most cases the ram 16 | ## Limit the uploads to 5MB to save - especially on small devices 17 | ## the device from dieing because OUT-OF-RAM exceptions 18 | ## in KB => 5MB 19 | server.upload-dirs = ( "/tmp" ) 20 | server.max-request-size = 5120 21 | 22 | server.errorlog = "/opt/piratebox/tmp/error.log" 23 | server.breakagelog = "/opt/piratebox/tmp/break.log" 24 | server.pid-file = "/opt/piratebox/tmp/lighttpd.pid" 25 | 26 | server.username = "nobody" 27 | server.groupname = "nogroup" 28 | 29 | 30 | 31 | index-file.names = ( "index.php", "index.html", 32 | "index.htm", "default.htm", 33 | " index.lighttpd.html" ) 34 | 35 | url.access-deny = ( "~", ".inc" ) 36 | 37 | # added .cgi .py 38 | static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" , ".cgi" , ".py" ) 39 | 40 | 41 | # Enable lighttpd on ipv6 42 | $SERVER["socket"] == "[::]:80" { } 43 | 44 | dir-listing.encoding = "utf-8" 45 | server.dir-listing = "enable" 46 | 47 | # Grabs main css 48 | dir-listing.external-css = "/content/css/page_style.css" 49 | 50 | # Header 51 | # Enables header section 52 | dir-listing.show-header = "enable" 53 | dir-listing.encode-header = "disable" 54 | # Hides HEADER.txt from listing 55 | dir-listing.hide-header-file = "enable" 56 | 57 | # Footer 58 | # Enables footer section 59 | dir-listing.show-readme = "enable" 60 | dir-listing.encode-readme = "disable" 61 | # Hides README.txt from listing 62 | dir-listing.hide-readme-file = "enable" 63 | # Diables default footer text 64 | dir-listing.set-footer = " " 65 | 66 | # Disabled, maybe fixes reload problem on imageboard 67 | #compress.cache-dir = "/var/cache/lighttpd/compress/" 68 | #compress.filetype = ( "application/x-javascript", "text/css", "text/html", "text/plain" ) 69 | 70 | #n.a. on router include_shell "/usr/share/lighttpd/create-mime.assign.pl" 71 | include "/opt/piratebox/conf/lighttpd/mime.types" 72 | 73 | #----------- ShoutBox-Env -------------- 74 | include "/opt/piratebox/conf/lighttpd/env" 75 | 76 | #----------- cgi.conf -------------- 77 | server.modules += ( "mod_cgi" ) 78 | 79 | $HTTP["url"] =~ "^/cgi-bin/" { 80 | # cgi.assign = ( "" => "" ) 81 | cgi.assign = ( ".py" => "/usr/bin/python" ) 82 | } 83 | 84 | ## Warning this represents a security risk, as it allow to execute any file 85 | ## with a .pl/.py even outside of /usr/lib/cgi-bin. 86 | # 87 | #cgi.assign = ( 88 | # ".pl" => "/usr/bin/perl", 89 | # ".py" => "/usr/bin/python", 90 | #) 91 | 92 | $HTTP["url"] =~ "^/board/" { 93 | cgi.assign = ( ".pl" => "/usr/bin/perl" , ) 94 | } 95 | #------------------------------------- 96 | 97 | 98 | setenv.add-response-header += ( "Cache-Control" => "max-age=60, must-revalidate, no-store, no-cache, public" ) 99 | 100 | # 404 Error Page with redirect 101 | # 102 | server.error-handler-404 = "/index.html" 103 | 104 | ## for better debugging 105 | #server.modules += ( "mod_accesslog" ) 106 | #accesslog.filename = "/opt/piratebox/tmp/access.log" 107 | 108 | 109 | # Fix for iOS7 110 | # It ask especially different domains without a specific URL. 111 | # It want to get a "success" message, to allow full system/internet access 112 | $HTTP["useragent"] =~ "CaptiveNetworkSupport" { 113 | server.document-root = "/opt/piratebox/www/library/test/" 114 | index-file.names = ( "success.html" ) 115 | dir-listing.activate = "disable" 116 | server.error-handler-404 = "/success.html" 117 | } 118 | 119 | 120 | include "/opt/piratebox/conf/lighttpd/fastcgi-php-generate203.conf" 121 | 122 | ## Uncommenting the following line enables PHP for the 123 | ## complete PirateBox 124 | #include "/opt/piratebox/conf/lighttpd/fastcgi-php.conf" 125 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/lighttpd/mime.types: -------------------------------------------------------------------------------- 1 | ## MimeType handling 2 | ## ------------------- 3 | ## 4 | ## Use the "Content-Type" extended attribute to obtain mime type if 5 | ## possible 6 | ## 7 | mimetype.use-xattr = "disable" 8 | 9 | ## 10 | ## mimetype mapping 11 | ## 12 | mimetype.assign = ( 13 | ".pdf" => "application/pdf", 14 | ".sig" => "application/pgp-signature", 15 | ".spl" => "application/futuresplash", 16 | ".class" => "application/octet-stream", 17 | ".ps" => "application/postscript", 18 | ".torrent" => "application/x-bittorrent", 19 | ".dvi" => "application/x-dvi", 20 | ".gz" => "application/x-gzip", 21 | ".pac" => "application/x-ns-proxy-autoconfig", 22 | ".swf" => "application/x-shockwave-flash", 23 | ".tar.gz" => "application/x-tgz", 24 | ".tgz" => "application/x-tgz", 25 | ".tar" => "application/x-tar", 26 | ".zip" => "application/zip", 27 | ".mp3" => "audio/mpeg", 28 | ".m3u" => "audio/x-mpegurl", 29 | ".wma" => "audio/x-ms-wma", 30 | ".wax" => "audio/x-ms-wax", 31 | ".ogg" => "application/ogg", 32 | ".wav" => "audio/x-wav", 33 | ".gif" => "image/gif", 34 | ".jpg" => "image/jpeg", 35 | ".jpeg" => "image/jpeg", 36 | ".png" => "image/png", 37 | ".xbm" => "image/x-xbitmap", 38 | ".xpm" => "image/x-xpixmap", 39 | ".xwd" => "image/x-xwindowdump", 40 | ".css" => "text/css", 41 | ".xhtml" => "application/xhtml+xml", 42 | ".html" => "text/html", 43 | ".htm" => "text/html", 44 | ".js" => "text/javascript", 45 | ".asc" => "text/plain", 46 | ".c" => "text/plain", 47 | ".cpp" => "text/plain", 48 | ".log" => "text/plain", 49 | ".conf" => "text/plain", 50 | ".text" => "text/plain", 51 | ".txt" => "text/plain", 52 | ".spec" => "text/plain", 53 | ".dtd" => "text/xml", 54 | ".xml" => "text/xml", 55 | ".mpeg" => "video/mpeg", 56 | ".mpg" => "video/mpeg", 57 | ".mov" => "video/quicktime", 58 | ".qt" => "video/quicktime", 59 | ".avi" => "video/x-msvideo", 60 | ".asf" => "video/x-ms-asf", 61 | ".asx" => "video/x-ms-asf", 62 | ".wmv" => "video/x-ms-wmv", 63 | ".mp4" => "video/mp4", 64 | ".bz2" => "application/x-bzip", 65 | ".tbz" => "application/x-bzip-compressed-tar", 66 | ".tar.bz2" => "application/x-bzip-compressed-tar", 67 | ".odt" => "application/vnd.oasis.opendocument.text", 68 | ".ods" => "application/vnd.oasis.opendocument.spreadsheet", 69 | ".odp" => "application/vnd.oasis.opendocument.presentation", 70 | ".odg" => "application/vnd.oasis.opendocument.graphics", 71 | ".odc" => "application/vnd.oasis.opendocument.chart", 72 | ".odf" => "application/vnd.oasis.opendocument.formula", 73 | ".odi" => "application/vnd.oasis.opendocument.image", 74 | ".odm" => "application/vnd.oasis.opendocument.text-master", 75 | ".ott" => "application/vnd.oasis.opendocument.text-template", 76 | ".ots" => "application/vnd.oasis.opendocument.spreadsheet-template", 77 | ".otp" => "application/vnd.oasis.opendocument.presentation-template", 78 | ".otg" => "application/vnd.oasis.opendocument.graphics-template", 79 | ".otc" => "application/vnd.oasis.opendocument.chart-template", 80 | ".otf" => "application/vnd.oasis.opendocument.formula-template", 81 | ".oti" => "application/vnd.oasis.opendocument.image-template", 82 | ".oth" => "application/vnd.oasis.opendocument.text-web", 83 | 84 | ".webm" => "video/webm", 85 | 86 | ".json" => "application/json", 87 | ".epub" => "application/epub+zip", 88 | ".fb2" => "text/xml", 89 | ".svg" => "image/svg+xml", 90 | ".gpx" => "application/gpx+xml", 91 | # make the default mime type application/octet-stream. 92 | "" => "application/octet-stream", 93 | ) 94 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/node.conf: -------------------------------------------------------------------------------- 1 | # Mesh-Node configuration 2 | # Contains the configuration which makes this node individual, like 3 | # random hostname & and specific IPv6 IP. 4 | NODE_CONFIG_ACTIVE='no' 5 | 6 | # 7 | NODE_IPV6_IP='' 8 | NODE_IPV6_MASK='/64' 9 | # Node-Name without domain suffix, like 10 | # foobar = Node-name 11 | # piratebox.lan = Host-Name (and base Domain-Name) 12 | # Fully Name will be later 13 | # foobar.piratebox.lan 14 | # If your leave the nodename empty, that will result in publishing hostname only. 15 | # Setting NODE_GEN to "no" it will take the NODE_NAME 1:1 for anouncements etc. without 16 | # adding the hostname as a suffix 17 | NODE_NAME='' 18 | NODE_GEN="yes" 19 | 20 | ## Node-Interface 21 | # Currently the same interface then the other wlan interface 22 | # But had to be used if mesh node interface is different and 23 | # initialized by PBx scripts. 24 | # If the node_interface is different, it has to be up and running. 25 | NODE_INTERFACE='$INTERFACE' 26 | # Should the Node-Interface setup via the PirateBox-Scripts 27 | NODE_IPV6_SET_IP='no' 28 | -------------------------------------------------------------------------------- /piratebox/piratebox/conf/piratebox.conf: -------------------------------------------------------------------------------- 1 | ######### 2 | ## Config for pirate-box WWW Release 3 | ## written by Matthias Strubel (matthias.strubel@aod-rpg.de) (c)2011-2014 4 | ## licenced under the GPL-3 ; feel free to improve or send me feedback 5 | ######## 6 | ## Configuration help 7 | ## If you plan to use one laptop as the piratebox: 8 | ## Set DO_IFCONFIG , USE_APN, USE_DNSMASQ to yes 9 | ## If you plan to run a two component setup (one router and one providing the storage+website) 10 | ## connected with ethernet: 11 | ## Set DO_IFCONFIG , USE_APN, USE_DNSMASQ to no 12 | ## Configure your ethernet eth0 (or whatever) to a static IP 13 | ## force your router to publish the HOST Option with your static IP; in case of dnsmasq add the /etc/hosts entrys 14 | ## Have a look at http://www.piratebox.cc for futher instructions 15 | ## 16 | ## You may deactivated severall option as needed. It's flexible. 17 | 18 | 19 | #----------------- Folder Configuration -------------------# 20 | 21 | PIRATEBOX_FOLDER="/opt/piratebox" 22 | WWW_FOLDER="/opt/piratebox/www" 23 | WWW_CONTENT="/opt/piratebox/share/content" 24 | 25 | #Do not change untill really needed. 26 | PIRATEBOX_PYTHONPATH="$PIRATEBOX_FOLDER/python_lib" 27 | 28 | 29 | #Datafolder , where is you usb-stick // drive mounted 30 | SHARE_FOLDER="$PIRATEBOX_FOLDER/share" 31 | 32 | #Upload Folder 33 | # Change this if you want to user uploaded data in a subfolder 34 | # Make sure the folder exists 35 | # UPLOADFOLDER="$SHARE_FOLDER/Upload" 36 | UPLOADFOLDER="$SHARE_FOLDER/Shared" 37 | 38 | #----------------- Startup Configuration -------------------# 39 | # Which Steps has to be done 40 | 41 | #Do network config 42 | DO_IFCONFIG="yes" 43 | 44 | #Do IW config - setting up a wlan0 interface with iw 45 | # for some wifi-cards required 46 | DO_IW="no" 47 | #Iw physical interface 48 | PHY_IF="phy0" 49 | 50 | # Check if interface exists 51 | # should be set to yes if you use a USB wifi card 52 | PROBE_INTERFACE="no" 53 | # wait how many seconds until throw an error 54 | PROBE_TIME=10 55 | 56 | #Start services... 57 | # act like a apn / 58 | # please have a look @ hostapd.conf ; you may need to change some options, regarding wifi-card 59 | USE_APN="yes" 60 | # act like dns&dhcp (dnsmasq) 61 | USE_DNSMASQ="yes" 62 | 63 | #HOSTNAME ... if you really want to change it, plz change: 64 | # www/index.html 65 | # 66 | # That is the Domain-Specifi part, where you reach always the local box 67 | HOST="piratebox.lan" 68 | 69 | #----------------- Configuration for DNSMASQ & IF-Setup -------------------# 70 | # Name of the wlan interface 71 | INTERFACE="wlan0" 72 | # On which interface DNSMASQ should listen. -i is the parameter for dnsmasq 73 | # Make it empty to disable 74 | DNSMASQ_INTERFACE="wlan0" 75 | 76 | #Brdige add interface (setr yes to enable bridging) 77 | DO_BRIDGE="no" 78 | BRIDGE="br-lan" 79 | 80 | #Network 81 | NET=192.168.77 82 | 83 | #IP-SHORT (is stringed together) 84 | # What IP does your Box have?? i.e. 1 => 192.168.77.1 85 | IP_SHORT=1 86 | 87 | #DHCP LEASE Start 88 | START_LEASE=10 89 | #DHCP LEASE End Range 90 | END_LEASE=250 91 | #Leasetime (When should the client renew it's IP) 92 | LEASE_DURATION=12h 93 | 94 | # Where is the leasefile stored to? 95 | LEASE_FILE_LOCATION=$PIRATEBOX_FOLDER/tmp/lease.file 96 | 97 | 98 | # Define the netmask 99 | NETMASK=255.255.255.0 100 | 101 | #SET IP for ifconfig stuff - DON'T CHANGE 102 | IP=$NET.$IP_SHORT 103 | 104 | #Load Config about ipv6 stuff - DON'T CHANGE 105 | . $PIRATEBOX_FOLDER/conf/ipv6.conf 106 | 107 | 108 | #--------------------------------------------------------------------------# 109 | # Node-Config path 110 | 111 | NODE_CONFIG="$PIRATEBOX_FOLDER/conf/node.conf" 112 | 113 | #----------------- Configuration for the pure piratebox -------------------# 114 | ## droopy, webserver, shoutbox- and forum-server 115 | 116 | ## Timesave file for non-RTC devices 117 | TIMESAVE="$PIRATEBOX_FOLDER/share/timesave_file" 118 | 119 | ## Format for storing & recovering the date&time 120 | TIMESAVE_FORMAT="+%C%g%m%d %H%M" 121 | 122 | #Start droopy? - Enable upload? 123 | DROOPY_ENABLED="yes" 124 | #Image-SRC 125 | IMAGENAME="piratebox-logo-small.png" 126 | IMAGE="$PIRATEBOX_FOLDER/src/$IMAGENAME" 127 | DROOPY_TXT="" 128 | DROOPY_PORT="8080" 129 | # Set correct permissions for an uploaded file 130 | # The following line needs to be commented for FAT32 / vfat partitions 131 | DROOPY_CHMOD="755" 132 | 133 | DROOPY_USERDIR="" 134 | # Uncomment line below for adding directory feature 135 | #DROOPY_USERDIR=" -u True " 136 | 137 | #Use UserId from lighttpd for droopy (use on ext-filesystems) 138 | DROOPY_USE_USER="yes" 139 | 140 | #Configuration for chat (If you decide to move the chat folder, you have to change /opt/piratebox/chat/cgi-bin/py* files ) 141 | CHATFILE="$WWW_FOLDER/cgi-bin/data.pso" 142 | 143 | #Generated File 144 | GEN_CHATFILE="$WWW_FOLDER/chat_content.html" 145 | 146 | #Generated File for DiskUsage 147 | GEN_DISKFILE="$WWW_FOLDER/diskusage.html" 148 | 149 | # Reset Shoutbox on Startup? 150 | RESET_CHAT="yes" 151 | 152 | ### Shoutbox is enabled. 153 | # When you set this option to "no", then the shoutbox file is not writable anymore 154 | # and in the json file the module is disabled. You should adjust the chat_init.txt 155 | # to make clear, that the box is not working anymore. 156 | SHOUTBOX_ENABLED="yes" 157 | 158 | SHOUTBOX_CLIENT_TIMESTAMP="no" 159 | 160 | #Inititiation Chat-Message 161 | ### This option was removed, you can find the chat message in conf/chat_init.txt 162 | 163 | #Provide files needed for PirateBox custom dirlisting 164 | CUSTOM_DIRLIST_COPY="yes" 165 | 166 | #Generate config json for frontend 167 | PBX_JSON_GENERATION="yes" 168 | PBX_JSON_FILE="$WWW_FOLDER/piratebox_config.json" 169 | 170 | #Activate Global chat 171 | # Still experimentall! 172 | GLOBAL_CHAT="no" 173 | 174 | #On which broadcast address should it send 175 | # Take care on the syntax!! 176 | GLOBAL_DEST="[ #255.255.255.255# , #10.255.255.255# , #$NET.255# ]" 177 | 178 | #------------------------ Additional configuration for lighttpd 179 | LIGHTTPD_USER=nobody 180 | LIGHTTPD_GROUP=nogroup 181 | 182 | 183 | #------------------------ IRC Configuration 184 | 185 | #Switch to yes if you want to enable the IRC-Server 186 | ENABLE_IRC_SERVER="no" 187 | IRC_USER="$LIGHTTPD_USER" 188 | 189 | ## If you want to save rooms and so on, create the folder 190 | # /opt/piratebox/share/IRC_STATE and make sure it is writeable 191 | # for IRC_USER (nobody per default) 192 | #IRC_STATE_DIR="$SHARE_FOLDER/IRC_STATE" 193 | 194 | #------------------------ Hook in user-config 195 | . $PIRATEBOX_FOLDER/conf/hook_custom.conf 196 | -------------------------------------------------------------------------------- /piratebox/piratebox/init.d/piratebox: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # /etc/init.d/piratebox 3 | 4 | ### BEGIN INIT INFO 5 | # Provides: piratebox 6 | # Required-Start: $all 7 | # Required-Stop: $network $local_fs 8 | # Default-Start: 2 3 4 5 9 | # Default-Stop: 6 1 0 10 | # Short-Description: All services around piratebox 11 | # Description: Based on /opt/piratebox/conf/piratebox.conf starts several services 12 | ### END INIT INFO 13 | 14 | ### 15 | # Default start-stop script for piratebox services on a laptop 16 | # written by Matthias Strubel (matthias.strubel@aod-rpg.de) 2011-02-22 17 | # licenced by gpl, feel free to improve and send me comments 18 | 19 | . /lib/lsb/init-functions 20 | 21 | 22 | [ -f /etc/default/rcS ] && . /etc/default/rcS 23 | 24 | # PATH for /opt piratebox folder 25 | PATH=$PATH:/opt/piratebox/bin 26 | 27 | PIDFILE_DROOPY=/var/run/piratebox_droopy.pid 28 | PIDFILE_HOSTAPN=/var/run/piratebox_hostapn.pid 29 | PIDFILE_DNSMASQ=/var/run/piratebox_dnsmasq.pid 30 | PIDFILE_LIGHTTPD=/opt/piratebox/tmp/lighttpd.pid 31 | PIDFILE_SHOUTBOX=/opt/piratebox/tmp/shoutbox_daemon.pid 32 | PIDFILE_RADVD=/opt/piratebox/tmp/radvd.pid 33 | PIDFILE_IRC=/opt/piratebox/tmp/irc.pid 34 | 35 | PIRATEBOX=/opt/piratebox 36 | CONF=$PIRATEBOX/conf/piratebox.conf 37 | CONF_IRC=$PIRATEBOX/conf/irc.conf 38 | #CONF_DROOPY=/opt/piratebox/conf/droopy.conf #not used 39 | CONF_APN=$PIRATEBOX/conf/hostapd.conf 40 | 41 | #Some extra config files for dnsmasq 42 | CONF_DNSMASQ=$PIRATEBOX/conf/dnsmasq_generated.conf 43 | 44 | CONF_RADVD=$PIRATEBOX/conf/radvd_generated.conf 45 | 46 | CONF_LIGHTTPD=$PIRATEBOX/conf/lighttpd/lighttpd.conf 47 | 48 | export PYTHONPATH=:$PYTHONPATH:$PIRATEBOX_PYTHONPATH 49 | 50 | 51 | # Some things that run always 52 | touch /var/lock/piratebox 53 | 54 | if [ -f $CONF ] ; then 55 | . $CONF 56 | else 57 | log_failure_msg "Configuration file not found" 58 | exit 1 59 | fi 60 | 61 | 62 | if [ -f $PIRATEBOX/conf/init_done ] ; then 63 | INIT=OK 64 | else 65 | $PIRATEBOX/bin/hooks/hook_pre_init.sh "$CONF" 66 | $PIRATEBOX/bin/install_piratebox.sh "$CONF" part2 67 | $PIRATEBOX/bin/hooks/hook_post_init.sh "$CONF" 68 | touch $PIRATEBOX/conf/init_done 69 | fi 70 | 71 | 72 | # Recreate the content folder, if it was deleted 73 | # only if it is not already existing. 74 | # This can be any time. 75 | if [ ! -d $WWW_CONTENT ] ; then 76 | $PIRATEBOX/bin/install_piratebox.sh "$CONF" content 77 | fi 78 | 79 | # Command Line for DNSMASQ, use extra config file generated from command above 80 | CMD_DNSMASQ="-x $PIDFILE_DNSMASQ -C $CONF_DNSMASQ " 81 | 82 | # Carry out specific functions when asked to by the system 83 | case "$1" in 84 | start) 85 | log_daemon_msg "Starting script piratebox " 86 | echo "" 87 | 88 | # Generate hosts & dnsmasq file 89 | $PIRATEBOX/bin/generate_config_files.sh "$CONF" 90 | 91 | $PIRATEBOX/bin/hooks/hook_piratebox_start.sh "$CONF" 92 | 93 | echo "Empty tmp folder" 94 | find $PIRATEBOX/tmp/ -exec rm {} \; 95 | 96 | if [ "$CUSTOM_DIRLIST_COPY" = "yes" ]; then 97 | echo "Copy over directory design files" 98 | $PIRATEBOX/bin/distribute_files.sh $SHARE_FOLDER/Shared 99 | fi 100 | 101 | if [ "$PBX_JSON_GENERATION" = "yes" ]; then 102 | $PIRATEBOX_FOLDER/bin/json_generation.sh $CONF 103 | fi 104 | 105 | if [ "$DO_IW" = "yes" ] ; then 106 | log_daemon_msg " Setting up Interface (iw) " 107 | iw $PHY_IF interface add $INTERFACE type managed 108 | fi 109 | 110 | if [ "$PROBE_INTERFACE" = yes ] ; then 111 | log_daemon_msg " Probing wlan" 112 | #Setting up WLAN Interface 113 | piratebox_setup_wlan.sh $CONF probe 114 | fi 115 | if [ $? -ne 0 ] ; then 116 | log_failure_msg "failed probe Interface" 117 | else 118 | 119 | # Only activate 120 | if [ "$USE_APN" = "yes" ] ; then 121 | log_daemon_msg "Starting hostap... " 122 | start-stop-daemon -m --start --background --pidfile $PIDFILE_HOSTAPN --exec /usr/sbin/hostapd -- $CONF_APN 123 | log_end_msg $? 124 | fi 125 | 126 | if [ "$DO_IFCONFIG" = yes ] ; then 127 | log_daemon_msg " Setting up wlan" 128 | #Setting up WLAN Interface 129 | piratebox_setup_wlan.sh $CONF start 130 | if [ $? -ne 0 ] ; then 131 | log_failure_msg "failed setting up Interface" 132 | exit 99 133 | fi 134 | fi 135 | 136 | #BRIDGE 137 | if [ "$DO_BRIDGE" = "yes" ] ; then 138 | log_daemon_msg "Adding $INTERFACE to bridge $BRIDGE // brctl addif $BRIDGE $INTERFACE " 139 | sleep 1 140 | BR_CMD="brctl addif $BRIDGE $INTERFACE" 141 | ( $BR_CMD ; ) 142 | log_end_msg $? 143 | fi 144 | 145 | if [ "$USE_DNSMASQ" = "yes" ] ; then 146 | log_daemon_msg "Starting dnsmasq... " 147 | # pidfile is written by dnsmasq 148 | start-stop-daemon --start --quiet --exec /usr/sbin/dnsmasq -- $CMD_DNSMASQ 149 | log_end_msg $? 150 | fi 151 | 152 | #Setting up firewall rules 153 | log_daemon_msg "Setting up firewall rules..." 154 | $PIRATEBOX_FOLDER/bin/firewall.sh -s 155 | log_end_msg $? 156 | 157 | 158 | if [ "$IPV6_ENABLE" = "yes" ] && [ "$IPV6_ADVERT" = "radvd" ] ; then 159 | log_daemon_msg "Starting radvd..." 160 | start-stop-daemon --start --quiet --exec /usr/bin/radvd -- -p $PIDFILE_RADVD -C $CONF_RADVD 161 | log_end_msg $? 162 | fi 163 | 164 | 165 | if [ "$DROOPY_ENABLED" = "yes" ] ; then 166 | #Start here the PirateBox-Parts droopy i.e. 167 | log_daemon_msg "Starting droopy..." 168 | #Delete 0 Byte Files 169 | delete_empty.sh $UPLOADFOLDER 170 | find $UPLOADFOLDER/ -iname tmp\* -exec rm {} \; 171 | 172 | DROOPY_USER="" 173 | if [ "$DROOPY_USE_USER" = "yes" ] ; then 174 | DROOPY_USER=" -c $LIGHTTPD_USER:$LIGHTTPD_GROUP " 175 | fi 176 | DROOPY_DO_CHMOD="" 177 | test -n "$DROOPY_CHMOD" && DROOPY_DO_CHMOD="--chmod $DROOPY_CHMOD" 178 | start-stop-daemon $DROOPY_USER -m --start --background --pidfile $PIDFILE_DROOPY --exec $PIRATEBOX/bin/droopy -- -d "$UPLOADFOLDER" -m "$DROOPY_TXT" $DROOPY_DO_CHMOD $DROOPY_USERDIR $DROOPY_PORT 179 | log_end_msg $? 180 | fi 181 | 182 | #Do shoutbox stuff 183 | $PIRATEBOX/bin/shoutbox_stuff.sh $WWW_FOLDER $CONF 184 | 185 | 186 | #Start here the lighttpd i.e. 187 | log_daemon_msg "Starting lighttpd..." 188 | start-stop-daemon --start --quiet --pidfile $PIDFILE_LIGHTTPD --exec /usr/sbin/lighttpd -- -f $CONF_LIGHTTPD 189 | log_end_msg $? 190 | 191 | #Start Global Chat daemon if needed. 192 | if [ "$GLOBAL_CHAT" = "yes" ] ; then 193 | log_daemon_msg "Starting global chat service..." 194 | start-stop-daemon -m --start --background --pidfile $PIDFILE_SHOUTBOX --startas $PIRATEBOX/bin/shoutbox_daemon.sh -- $CONF 195 | log_end_msg $? 196 | fi 197 | 198 | #Start IRC Server 199 | if [ "$ENABLE_IRC_SERVER" = "yes" ] ; then 200 | 201 | . $CONF_IRC 202 | 203 | IRC_PARMS="--setuid $IRC_USER --daemon --motd $IRC_MOTD --pid-file $PIDFILE_IRC " 204 | 205 | if [ ! -z "$IRC_STATEDIR" ] ; then 206 | IRC_PARMS=" $IRCPARMS --statedir $IRC_STATEDIR " 207 | fi 208 | 209 | log_daemon_msg "Starting Miniircd..." 210 | start-stop-daemon -S -x $PIRATEBOX/bin/miniircd.py -- $IRC_PARMS 211 | log_end_msg $? 212 | fi 213 | fi 214 | 215 | $PIRATEBOX/bin/hooks/hook_piratebox_start_done.sh "$CONF" 216 | 217 | ;; 218 | stop) 219 | log_daemon_msg "Stopping script piratebox" 220 | echo "" 221 | 222 | $PIRATEBOX/bin/hooks/hook_piratebox_stop.sh "$CONF" 223 | 224 | if [ "$ENABLE_IRC_SERVER" = "yes" ] ; then 225 | log_daemon_msg "Stopping IRC..." 226 | start-stop-daemon -s 9 -K -q -p $PIDFILE_IRC 227 | log_end_msg $? 228 | fi 229 | 230 | log_daemon_msg "Removing firewall rules..." 231 | $PIRATEBOX_FOLDER/bin/firewall.sh -k 232 | log_end_msg $? 233 | 234 | if [ "$USE_APN" = "yes" ] ; then 235 | log_daemon_msg "Stopping hostap... " 236 | start-stop-daemon --stop --quiet --pidfile $PIDFILE_HOSTAPN --oknodo --startas "hostapd" 237 | log_end_msg $? 238 | fi 239 | if [ "$USE_DNSMASQ" = "yes" ] ; then 240 | log_daemon_msg "Stopping dnsmasq..." 241 | start-stop-daemon --stop --quiet --pidfile $PIDFILE_DNSMASQ 242 | log_end_msg $? 243 | fi 244 | 245 | if [ -e $PIDFILE_RADVD ] ; then 246 | log_daemon_msg "Stopping radvd..." 247 | start-stop-daemon --stop --quite --pidfile $PIDFILE_RADVD 248 | log_end_msg $? 249 | fi 250 | 251 | #Stop Global Chat daemon 252 | if [ "$GLOBAL_CHAT" = "yes" ] ; then 253 | log_daemon_msg "Stopping global chat service..." 254 | start-stop-daemon --stop --quiet --pidfile $PIDFILE_SHOUTBOX 255 | log_end_msg $? 256 | fi 257 | 258 | log_daemon_msg "Stopping lighttpd..." 259 | start-stop-daemon --stop --retry 30 --quiet --pidfile $PIDFILE_LIGHTTPD 260 | log_end_msg $? 261 | 262 | if [ "$DROOPY_ENABLED" = "yes" ] ; then 263 | #Kill Droopy 264 | log_daemon_msg "Stopping droopy... " 265 | start-stop-daemon --stop --quiet --pidfile $PIDFILE_DROOPY --oknodo --startas "python /opt/piratebox/bin/droopy" 266 | log_end_msg $? 267 | fi 268 | 269 | if [ "$DO_IFCONFIG" = yes ] ; then 270 | piratebox_setup_wlan.sh $CONF stop 271 | fi 272 | 273 | if [ "$DO_IW" = "yes" ] ; then 274 | iw dev $INTERFACE del 275 | fi 276 | 277 | # REMOVE BRIDGE 278 | if [ "$DO_BRIDGE" = "yes" ] ; then 279 | log_daemon_msg "Remove Bridge..." 280 | BR_CMD="brctl delif $BRIDGE $INTERFACE" 281 | ( $BR_CMD ; ) 282 | log_end_msg $? 283 | fi 284 | 285 | $PIRATEBOX/bin/hooks/hook_piratebox_stop_done.sh "$CONF" 286 | 287 | 288 | ;; 289 | *) 290 | echo "Usage: /etc/init.d/piratebox {start|stop}" 291 | exit 1 292 | ;; 293 | esac 294 | 295 | exit 0 296 | -------------------------------------------------------------------------------- /piratebox/piratebox/init.d/piratebox_alt: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # /etc/init.d/piratebox 3 | 4 | ### BEGIN INIT INFO 5 | # Provides: piratebox 6 | # Required-Start: $all 7 | # Required-Stop: $network $local_fs 8 | # Default-Start: 2 3 4 5 9 | # Default-Stop: 6 1 0 10 | # Short-Description: All services around piratebox 11 | # Description: Based on /opt/piratebox/conf/piratebox.conf starts: * DNSMASQ * HOSTAPD * DROOPY * WLAN-config * CHAT 12 | ### END INIT INFO 13 | 14 | ### 15 | # Default start-stop script for piratebox services on a laptop 16 | # written by Matthias Strubel (matthias.strubel@aod-rpg.de) 2011-02-22 17 | # licenced by gpl, feel free to improve and send me comments 18 | 19 | 20 | [ -f /etc/default/rcS ] && . /etc/default/rcS 21 | 22 | # PATH for /opt piratebox folder 23 | PATH=$PATH:/opt/piratebox/bin 24 | 25 | PIDFILE_DROOPY=/var/run/piratebox_droopy.pid 26 | PIDFILE_HOSTAPN=/var/run/piratebox_hostapn.pid 27 | PIDFILE_DNSMASQ=/var/run/piratebox_dnsmasq.pid 28 | PIDFILE_LIGHTTPD=/opt/piratebox/tmp/lighttpd.pid 29 | PIDFILE_SHOUTBOX=/opt/piratebox/tmp/shoutbox_daemon.pid 30 | PIDFILE_RADVD=/opt/piratebox/tmp/radvd.pid 31 | PIDFILE_IRC=/opt/piratebox/tmp/irc.pid 32 | 33 | PIRATEBOX=/opt/piratebox 34 | CONF=$PIRATEBOX/conf/piratebox.conf 35 | CONF_IRC=$PIRATEBOX/conf/irc.conf 36 | CONF_APN=$PIRATEBOX/conf/hostapd.conf 37 | 38 | #Some extra config files for dnsmasq 39 | CONF_DNSMASQ=$PIRATEBOX/conf/dnsmasq_generated.conf 40 | 41 | CONF_RADVD=$PIRATEBOX/conf/radvd_generated.conf 42 | 43 | CONF_LIGHTTPD=$PIRATEBOX/conf/lighttpd/lighttpd.conf 44 | 45 | export PYTHONPATH=:$PYTHONPATH:$PIRATEBOX_PYTHONPATH 46 | 47 | if [ -f $CONF ] ; then 48 | . $CONF 49 | else 50 | echo "Configuration file not found" 51 | exit 1 52 | fi 53 | 54 | #If you can't find this file 55 | if [[ -f $PIRATEBOX/conf/init_done ]] ; then 56 | INIT=OK 57 | else 58 | $PIRATEBOX/bin/hooks/hook_pre_init.sh "$CONF" 59 | $PIRATEBOX/bin/install_piratebox.sh "$CONF" part2 60 | $PIRATEBOX/bin/hooks/hook_post_init.sh "$CONF" 61 | touch $PIRATEBOX/conf/init_done 62 | fi 63 | 64 | 65 | # Recreate the content folder, if it was deleted 66 | # only if it is not already existing. 67 | # This can be any time. 68 | if [ ! -d $WWW_CONTENT ] ; then 69 | $PIRATEBOX/bin/install_piratebox.sh "$CONF" content 70 | fi 71 | 72 | 73 | # Command Line for DNSMASQ, use extra config file generated from command above 74 | CMD_DNSMASQ="-x $PIDFILE_DNSMASQ -C $CONF_DNSMASQ " 75 | 76 | # Carry out specific functions when asked to by the system 77 | case "$1" in 78 | start) 79 | echo "Starting script piratebox " 80 | 81 | # Generate hosts & dnsmasq file 82 | $PIRATEBOX/bin/generate_config_files.sh "$CONF" 83 | 84 | $PIRATEBOX/bin/hooks/hook_piratebox_start.sh "$CONF" 85 | 86 | echo "Empty tmp folder" 87 | find $PIRATEBOX/tmp/ -exec rm {} \; 88 | 89 | if [ "$CUSTOM_DIRLIST_COPY" = "yes" ]; then 90 | echo "Copy over directory design files" 91 | $PIRATEBOX/bin/distribute_files.sh $SHARE_FOLDER/Shared 92 | fi 93 | 94 | if [ "$PBX_JSON_GENERATION" = "yes" ]; then 95 | $PIRATEBOX_FOLDER/bin/json_generation.sh $CONF 96 | fi 97 | 98 | if [ "$DO_IW" = "yes" ] ; then 99 | log_daemon_msg " Setting up Interface (iw) " 100 | iw $PHY_IF interface add $INTERFACE type managed 101 | fi 102 | 103 | if [ "$PROBE_INTERFACE" = "yes" ] ; then 104 | echo " Probe wlan" 105 | #Setting up WLAN Interface 106 | piratebox_setup_wlan.sh $CONF probe 107 | fi 108 | if [ $? -ne 0 ] ; then 109 | echo "failed probing Interface" 110 | else 111 | 112 | # Only activate 113 | if [ "$USE_APN" = "yes" ] ; then 114 | echo "Starting hostap... " 115 | start-stop-daemon -m -S -b -p $PIDFILE_HOSTAPN -x /usr/sbin/hostapd -- $CONF_APN 116 | echo $? 117 | fi 118 | 119 | if [ "$DO_IFCONFIG" = "yes" ] ; then 120 | echo " Setting up wlan" 121 | #Setting up WLAN Interface 122 | piratebox_setup_wlan.sh $CONF start 123 | if [ $? -ne 0 ] ; then 124 | echo "failed setting up Interface" 125 | exit 255 126 | fi 127 | fi 128 | #BRIDGE 129 | if [ "$DO_BRIDGE" = "yes" ] ; then 130 | echo "Adding $INTERFACE to bridge $BRIDGE // brctl addif $BRIDGE $INTERFACE " 131 | sleep 1 132 | BR_CMD="brctl addif $BRIDGE $INTERFACE" 133 | ( $BR_CMD ; ) 134 | if [ $? -ne 0 ] ; then 135 | echo "failed :( " 136 | fi 137 | fi 138 | 139 | if [ "$USE_DNSMASQ" = "yes" ] ; then 140 | echo "Starting dnsmasq... " 141 | # pidfile is written by dnsmasq 142 | start-stop-daemon -S -q -x /usr/sbin/dnsmasq -- $CMD_DNSMASQ 143 | echo $? 144 | fi 145 | 146 | 147 | echo "Setting up firewall rules..." 148 | $PIRATEBOX_FOLDER/bin/firewall.sh -s 149 | echo $? 150 | 151 | if [ "$IPV6_ENABLE" = "yes" ] && [ "$IPV6_ADVERT" = "radvd" ] ; then 152 | # Ugly hack on PirateBox 1.1.x only 153 | if test -e "/usr/local/usr/sbin/radvd" && test ! -e "/usr/bin/radvd" ; then 154 | echo "Deploy ugly hack for radvd on PirateBox 1.1" 155 | ln -sf /usr/local/usr/sbin/radvd /usr/bin/radvd 156 | fi 157 | echo "Starting radvd..." 158 | start-stop-daemon -S -q -x /usr/bin/radvd -- -p $PIDFILE_RADVD -C $CONF_RADVD 159 | echo $? 160 | fi 161 | 162 | 163 | 164 | if [ "$DROOPY_ENABLED" = "yes" ] ; then 165 | #Start here the PirateBox-Parts droopy i.e. 166 | echo "Starting droopy..." 167 | find $UPLOADFOLDER/ -iname tmp\* -exec rm {} \; 168 | #Delete 0 Byte Files 169 | delete_empty.sh $UPLOADFOLDER 170 | 171 | DROOPY_USER="" 172 | if [ "$DROOPY_USE_USER" = "yes" ] ; then 173 | DROOPY_USER=" -c $LIGHTTPD_USER:$LIGHTTPD_GROUP " 174 | fi 175 | DROOPY_DO_CHMOD="" 176 | test -n "$DROOPY_CHMOD" && DROOPY_DO_CHMOD="--chmod $DROOPY_CHMOD" 177 | start-stop-daemon $DROOPY_USER -m -S -b -p $PIDFILE_DROOPY -x $PIRATEBOX/bin/droopy -- -d "$UPLOADFOLDER" -m "$DROOPY_TXT" $DROOPY_DO_CHMOD $DROOPY_USERDIR $DROOPY_PORT 178 | echo $? 179 | fi 180 | 181 | #Do shoutbox stuff 182 | $PIRATEBOX/bin/shoutbox_stuff.sh $WWW_FOLDER $CONF 183 | 184 | 185 | #Start here the lighttpd i.e. 186 | echo "Starting lighttpd..." 187 | start-stop-daemon -S -q -p $PIDFILE_LIGHTTPD -x /usr/sbin/lighttpd -- -f $CONF_LIGHTTPD 188 | echo $? 189 | 190 | #Start Global Chat daemon if needed. 191 | if [ "$GLOBAL_CHAT" = "yes" ] ; then 192 | echo "Starting global chat service..." 193 | start-stop-daemon -S -m -b -p $PIDFILE_SHOUTBOX -x $PIRATEBOX/bin/shoutbox_daemon.sh -- $CONF 194 | echo $? 195 | fi 196 | 197 | #Start IRC Server 198 | if [ "$ENABLE_IRC_SERVER" = "yes" ] ; then 199 | . $CONF_IRC 200 | IRC_PARMS="--setuid $IRC_USER --daemon --motd $IRC_MOTD --pid-file $PIDFILE_IRC " 201 | 202 | if [ ! -z "$IRC_STATEDIR" ] ; then 203 | IRC_PARMS=" $IRCPARMS --statedir $IRC_STATEDIR " 204 | fi 205 | echo "Starting Miniircd..." 206 | start-stop-daemon -S -x $PIRATEBOX/bin/miniircd.py -- $IRC_PARMS 207 | echo $? 208 | fi 209 | fi 210 | 211 | $PIRATEBOX/bin/hooks/hook_piratebox_start_done.sh "$CONF" 212 | 213 | ;; 214 | stop) 215 | echo "Stopping script piratebox" 216 | 217 | $PIRATEBOX/bin/hooks/hook_piratebox_stop.sh "$CONF" 218 | 219 | if [ "$USE_APN" = "yes" ] ; then 220 | echo "Stopping hostap... " 221 | start-stop-daemon -K -q -p $PIDFILE_HOSTAPN 222 | echo $? 223 | fi 224 | if [ "$USE_DNSMASQ" = "yes" ] ; then 225 | echo "Stopping dnsmasq..." 226 | start-stop-daemon -K -q -p $PIDFILE_DNSMASQ 227 | echo $? 228 | fi 229 | 230 | 231 | echo "Removing firewall rules..." 232 | $PIRATEBOX_FOLDER/bin/firewall.sh -k 233 | echo $? 234 | 235 | if [ -e $PIDFILE_RADVD ] ; then 236 | echo "Stopping radvd..." 237 | start-stop-daemon -K -q -p $PIDFILE_RADVD 238 | echo $? 239 | fi 240 | 241 | 242 | if [ "$DROOPY_ENABLED" = "yes" ] ; then 243 | #Kill Droopy 244 | echo "Stopping droopy... " 245 | start-stop-daemon -s 9 -K -q -p $PIDFILE_DROOPY 246 | echo $? 247 | fi 248 | 249 | #Start Global Chat daemon if needed. 250 | if [ "$GLOBAL_CHAT" = "yes" ] ; then 251 | echo "Stopping global chat service..." 252 | start-stop-daemon -K -q -p $PIDFILE_SHOUTBOX 253 | echo $? 254 | fi 255 | 256 | if [ "$ENABLE_IRC_SERVER" = "yes" ] ; then 257 | echo "Stopping IRC..." 258 | start-stop-daemon -s 9 -K -q -p $PIDFILE_IRC 259 | echo $? 260 | fi 261 | 262 | 263 | 264 | echo "Stopping lighttpd..." 265 | start-stop-daemon -K -q -p $PIDFILE_LIGHTTPD 266 | echo $? 267 | 268 | 269 | if [ "$DO_IFCONFIG" = "yes" ] ; then 270 | piratebox_setup_wlan.sh $CONF stop 271 | fi 272 | 273 | if [ "$DO_IW" = "yes" ] ; then 274 | iw dev $INTERFACE del 275 | fi 276 | 277 | #BRIDGE 278 | if [ "$DO_BRIDGE" = "yes" ] ; then 279 | echo "Remove $INTERFACE to bridge $BRIDGE // brctl addif 280 | $BRIDGE $INTERFACE " 281 | sleep 1 282 | BR_CMD="brctl delif $BRIDGE $INTERFACE" 283 | ( $BR_CMD ; ) 284 | if [ $? -ne 0 ] ; then 285 | echo "failed :( " 286 | fi 287 | fi 288 | 289 | $PIRATEBOX/bin/hooks/hook_piratebox_stop_done.sh "$CONF" 290 | ;; 291 | *) 292 | echo "Usage: /etc/init.d/piratebox {start|stop}" 293 | exit 1 294 | ;; 295 | esac 296 | 297 | exit 0 298 | -------------------------------------------------------------------------------- /piratebox/piratebox/lib/json_func.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Matthias Strubel (c) 2013 - GPL3 4 | 5 | convert_yn_to_tf(){ 6 | local value=$1 ; shift 7 | if [ "$value" == "yes" ] ; then 8 | echo "true" 9 | else 10 | echo "false" 11 | fi 12 | } 13 | -------------------------------------------------------------------------------- /piratebox/piratebox/lib/node_name_generation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Script for node name generation. 4 | # Requires: 5 | # argument 1: HOST (hostname) 6 | # argument 2: NODE_NAME 7 | # argument 3: NODE_GEN 8 | #- 9 | # Output in var NODE_GEN_OUTPUT 10 | # 11 | 12 | generate_node_name() { 13 | local in_host=$1 14 | local in_node_name=$2 15 | local in_node_gen=$3 16 | 17 | local complete_node_name=$in_node_name"."$in_host 18 | 19 | if [ "$in_node_gen" = "no" ] ; then 20 | complete_node_name=$in_node_name 21 | fi 22 | if [ "$in_node_name" = "" ] ; then 23 | complete_node_name=$in_host 24 | fi 25 | if [ "$complete_node_name" != "" ] ; then 26 | export NODE_GEN_OUTPUT=$complete_node_name 27 | return 0 28 | else 29 | echo "Error: No valid node-name found" 30 | return 1 31 | fi 32 | } 33 | -------------------------------------------------------------------------------- /piratebox/piratebox/lib/node_name_resolution.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## Library for some kind of avahi-node name resolution 4 | ## over piratebox mesh network 5 | NODE_IP="" 6 | 7 | ## This function takes the normal 8 | # gjgtjtjt.piratebox.lan 9 | # hostname converts it to: 10 | # gjgtjtjt_piratebox_lan.local 11 | # makes an avahi resolution and gives back the IP in NODE_IP 12 | # uf it was found 13 | resolve_node_hostname() { 14 | local in_nodename=$1 15 | 16 | local AVAHI_HOST=$( echo $in_nodename | sed 's|\.|_|g' ) 17 | local bonjour_hostname="$AVAHI_HOST"".local" 18 | local output=$( avahi-resolve-host-name -6 $bonjour_hostname ) 19 | 20 | if [ ! -z "$output" ] ; then 21 | echo "Found host: $output" 22 | #Sorry for that worse splitup of name and IP 23 | NODE_IP=$( echo $output | sed "s|$bonjour_hostname||" ) 24 | return 0 25 | else 26 | return 1 27 | fi 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /piratebox/piratebox/python_lib/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PirateBox-Dev/PirateBoxScripts_Webserver/25621d780cc27df4ca5b647a303332709c3aa2ab/piratebox/piratebox/python_lib/.keep -------------------------------------------------------------------------------- /piratebox/piratebox/python_lib/broadcast.py: -------------------------------------------------------------------------------- 1 | # PirateBox send Message lib (C)2012-2014 2 | # modified by Matthias Strubel 3 | # 4 | # Original Version by 5 | # 6 | # Forban - a simple link-local opportunistic p2p free software 7 | # 8 | # For more information : http://www.foo.be/forban/ 9 | # 10 | # Copyright (C) 2009-2010 Alexandre Dulaunoy - http://www.foo.be/ 11 | # 12 | # This program is free software: you can redistribute it and/or modify 13 | # it under the terms of the GNU Affero General Public License as published by 14 | # the Free Software Foundation, either version 3 of the License, or 15 | # (at your option) any later version. 16 | # 17 | # This program is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | # GNU Affero General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Affero General Public License 23 | # along with this program. If not, see . 24 | 25 | 26 | import socket 27 | import string 28 | import time 29 | import datetime 30 | try: 31 | from hashlib import sha1 32 | except ImportError: 33 | from sha import sha as sha1 34 | import re 35 | import sys 36 | 37 | 38 | flogger = None 39 | debug = 0 40 | 41 | 42 | class broadcast: 43 | def __init__(self, name="notset", uuid=None, port="12556", timestamp=None, 44 | auth=None, destination=["ff02::1", "255.255.255.255", ]): 45 | self.name = name 46 | self.uuid = uuid 47 | self.port = port 48 | self.count = 0 49 | self.destination = destination 50 | self.ipv6_disabled = 0 51 | 52 | def disableIpv6(self): 53 | self.ipv6_disabled = 1 54 | self.destination = ["255.255.255.255", ] 55 | 56 | def setDestination(self, destination=["ff02::1", "255.255.255.255", ]): 57 | self.destination = destination 58 | 59 | def set(self, content): 60 | self.payload = content 61 | 62 | def get(self): 63 | return self.payload 64 | 65 | def __debugMessage(self, msg): 66 | if flogger is not None: 67 | flogger.debug(msg) 68 | elif debug == 1: 69 | print msg 70 | 71 | def __errorMessage(self, msg): 72 | if flogger is not None: 73 | flogger.error(msg) 74 | elif debug == 1: 75 | print msg 76 | 77 | def send(self): 78 | for destination in self.destination: 79 | if socket.has_ipv6 and re.search(":", destination) and not \ 80 | self.ipv6_disabled == 1: 81 | 82 | self.__debugMessage("working in ipv6 part on destination " + 83 | destination) 84 | 85 | # Even if Python is compiled with IPv6, it doesn't mean that 86 | # the os is supporting IPv6. (like the Nokia N900) 87 | try: 88 | sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM, 89 | socket.IPPROTO_UDP) 90 | # Required on some version of MacOS X while sending IPv6 91 | # UDP datagram 92 | sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 1) 93 | except: 94 | sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 95 | socket.IPPROTO_UDP) 96 | 97 | else: 98 | self.__debugMessage("open ipv4 socket on destination " + 99 | destination) 100 | sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 101 | socket.IPPROTO_UDP) 102 | sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) 103 | 104 | try: 105 | sock.sendto(self.payload, (destination, int(self.port))) 106 | except socket.error, msg: 107 | self.__errorMessage("Error sending to " + destination + " : " + 108 | msg.strerror) 109 | continue 110 | sock.close() 111 | 112 | 113 | def managetest(): 114 | msg = broadcast() 115 | msg.set("Test") 116 | print msg.get() 117 | msg.send() 118 | 119 | if __name__ == "__main__": 120 | managetest() 121 | -------------------------------------------------------------------------------- /piratebox/piratebox/python_lib/discover.py: -------------------------------------------------------------------------------- 1 | # PirateBox Message broadcasting lib (C)2012-2014 2 | # Matthias Strubel 3 | 4 | import SocketServer 5 | import socket 6 | import sys 7 | import os 8 | 9 | import messages 10 | from psogen import writeToDisk, generate_html_from_file 11 | 12 | 13 | lastmsg = "" 14 | 15 | 16 | class MyUDPHandler(SocketServer.BaseRequestHandler): 17 | def handle(self): 18 | global lastmsg 19 | data = self.request[0].strip() 20 | socket = self.request[1] 21 | if data[:9] == "piratebox": 22 | if data[10:12] == "sb": 23 | if data != lastmsg: 24 | msg = messages.shoutbox_message() 25 | msg.set_message(data) 26 | content = msg.get() 27 | writeToDisk(content) 28 | generate_html_from_file() 29 | lastmsg = data 30 | else: 31 | print data[11:12] 32 | print data 33 | else: 34 | print "debug : not a piratebox message" 35 | 36 | 37 | class UDPServer(SocketServer.UDPServer): 38 | def setIPv6(self, ipv6=1): 39 | if ipv6 == 0: 40 | self.disable_ipv6 = 1 41 | else: 42 | self.disable_ipv6 = 0 43 | 44 | def useIPv6(self): 45 | return True 46 | 47 | if self.disable_ipv6 == 1: 48 | return False 49 | else: 50 | return True 51 | 52 | if socket.has_ipv6: 53 | try: 54 | socktest = socket.socket(socket.AF_INET6) 55 | socktest.close() 56 | address_family = socket.AF_INET6 57 | except: 58 | address_family = socket.AF_INET 59 | 60 | def server_bind(self): 61 | if self.useIPv6(): 62 | self.v6success = True 63 | try: 64 | socktest = socket.socket(socket.AF_INET6) 65 | socktest.close() 66 | except: 67 | self.v6success = False 68 | 69 | if socket.has_ipv6 and self.v6success: 70 | address_family = socket.AF_INET6 71 | 72 | #allowing to work in dual-stack when IPv6 is used 73 | if socket.has_ipv6 and self.v6success: 74 | self.socket.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 75 | 0) 76 | self.socket.bind(self.server_address) 77 | 78 | if __name__ == "__main__": 79 | HOST, PORT = ("::", 12556) 80 | server = UDPServer((HOST, PORT), MyUDPHandler) 81 | server.setIPv6(0) 82 | server.serve_forever() 83 | -------------------------------------------------------------------------------- /piratebox/piratebox/python_lib/diskusage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Library to write the current disk usage 4 | 5 | # Heavily Modified version the ShoutBox Library (psogen.py) 6 | 7 | import os, re, datetime 8 | from psutil import disk_usage 9 | 10 | htmlfilename = os.environ["DISK_GEN_HTMLFILE"] 11 | delay = 60*5 #In seconds 12 | 13 | #-------------- 14 | # Generates Shoutbox-HTML-Frame ... 15 | # Imports: 16 | # content - String containing preformatted data 17 | #-------------- 18 | def generate_html(content): 19 | htmlstring = "DiskUsage Data" 20 | htmlstring += content 21 | htmlstring += "" 22 | return htmlstring 23 | 24 | def modification_date(filename): 25 | moddate = os.path.getmtime(filename) 26 | return datetime.datetime.fromtimestamp(moddate) 27 | 28 | #-------------- 29 | # Generates HTML Data based on given content and write it to static html file 30 | # Imports: 31 | # content - String containing preformatted data 32 | #-------------- 33 | def generate_html_into_file(content): 34 | open(htmlfilename, 'w').close() 35 | htmlstring = generate_html ( content ) 36 | htmlfile = open( htmlfilename , 'w' ) 37 | htmlfile.truncate() 38 | htmlfile.write( htmlstring ) 39 | htmlfile.close() 40 | 41 | #-------------- 42 | # Function for saving the disk usage to a file. Called by HTML-Form 43 | #-------------- 44 | def get_usage(drive): 45 | 46 | try: 47 | file_mod_time = modification_date(htmlfilename) 48 | except OSError: 49 | content = prepare_line(drive) 50 | generate_html_into_file(content) 51 | file_mod_time = modification_date(htmlfilename) 52 | 53 | now = datetime.datetime.today() 54 | max_delay = datetime.timedelta(0,delay) 55 | age = now - file_mod_time 56 | 57 | #Add delay. 58 | if age < max_delay: 59 | print "CRITICAL: {} modified {} minutes ago. Threshold set to {} minutes. Cannot update.".format(htmlfilename, age.seconds/60, max_delay.seconds/60) 60 | else: 61 | print "OK. File last modified {} minutes ago. Updating now...".format(age.seconds/60) 62 | content = prepare_line(drive) 63 | generate_html_into_file(content) 64 | 65 | #-------------- 66 | # Function for returning the amount of free space as an Integer 67 | #-------------- 68 | def FreeSpace(drive): 69 | """ Return the FreeSape of a shared drive in bytes""" 70 | try: 71 | usage = disk_usage(drive) 72 | floatpercent = float(usage.used) / float(usage.total) 73 | percent = int(100*floatpercent) 74 | return percent 75 | except: 76 | return 0 77 | 78 | 79 | #-------------- 80 | # Function which formats the about of freespace into a nice readable format 81 | #-------------- 82 | def prepare_line (drive): 83 | data = str(FreeSpace(drive)) 84 | # Trying to make it look like this: 85 | #
86 | #
87 | # 15% Full 88 | #
89 | #
90 | content = "
" + data + "% Full
" 91 | return content 92 | 93 | #-------------- 94 | # Generating static HTML File 95 | #-------------- 96 | if __name__ == "__main__": 97 | 98 | disk = "/opt/piratebox/share/Shared" 99 | 100 | if os.path.exists(htmlfilename) != True: 101 | content = prepare_line(disk) 102 | generate_html_into_file(content) 103 | else: 104 | get_usage(disk) 105 | 106 | print "Generated HTML-DiskUsage File." 107 | -------------------------------------------------------------------------------- /piratebox/piratebox/python_lib/messages.py: -------------------------------------------------------------------------------- 1 | # PirateBox Message lib (C)2012-2014 2 | # Matthias Strubel 3 | 4 | import string 5 | import socket 6 | import base64 7 | import sys 8 | 9 | 10 | class message: 11 | def __init__(self, name="generate"): 12 | if name == "generate": 13 | self.name = socket.gethostname() 14 | else: 15 | self.name = name 16 | 17 | self.type = "gc" 18 | self.decoded = "" 19 | 20 | def set(self, content=" "): 21 | base64content = base64.b64encode(content) 22 | self.decoded = "piratebox;" + self.type + ";01;" + self.name + ";" + \ 23 | base64content 24 | 25 | def get(self): 26 | # TODO Split decoded part 27 | message_parts = string.split(self.decoded, ";") 28 | 29 | if message_parts[0] != "piratebox": 30 | return None 31 | 32 | b64_content_part = message_parts[4] 33 | 34 | content = base64.b64decode(b64_content_part) 35 | return content 36 | 37 | def get_sendername(self): 38 | return self.name 39 | 40 | def get_message(self): 41 | return self.decoded 42 | 43 | def set_message(self, decoded): 44 | self.decoded = decoded 45 | 46 | 47 | class shoutbox_message(message): 48 | def __init__(self, name="generate"): 49 | message.__init__(self, name) 50 | self.type = "sb" 51 | -------------------------------------------------------------------------------- /piratebox/piratebox/python_lib/psogen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Modificated ShoutBox Library (C)2013-2014 4 | # enables further modifications for the ShoutBox 5 | # Run without to generate htmlfile 6 | # Run the following to enter a new line from command line 7 | # psogen.py input Anonymous default "Text" 8 | 9 | import os 10 | import datetime 11 | import re 12 | import messages 13 | import broadcast 14 | 15 | 16 | datafilename = os.environ["SHOUTBOX_CHATFILE"] 17 | htmlfilename = os.environ["SHOUTBOX_GEN_HTMLFILE"] 18 | clienttimestamp = os.environ["SHOUTBOX_CLIENT_TIMESTAMP"] 19 | 20 | try: 21 | raw_dest = os.environ["SHOUTBOX_BROADCAST_DESTINATIONS"] 22 | finished_dest = re.sub('#', '"', raw_dest) 23 | broadcast_destination = eval(finished_dest) 24 | except KeyError: 25 | broadcast_destination = False 26 | 27 | 28 | def html_escape(text): 29 | """ 30 | Removes HTML chars from the given text and replace them with HTML entities. 31 | """ 32 | html_escape_table = { 33 | '"': """, "'": "'", ">": ">", 34 | "<": "<"} 35 | return "".join(html_escape_table.get(c, c) for c in text) 36 | 37 | 38 | def generate_html(content): 39 | """ 40 | Generates Shoutbox-HTML-Frame... 41 | 42 | Args: 43 | content: String containing preformatted data 44 | """ 45 | htmlstring = "" \ 47 | "Shout-Out Data" 48 | htmlstring += content 49 | htmlstring += "" 50 | return htmlstring 51 | 52 | 53 | def generate_html_into_file(content): 54 | """ 55 | Generates HTML Data based on given content and write it to static html 56 | file. 57 | 58 | Args: 59 | content: String containing preformatted data 60 | """ 61 | htmlstring = generate_html(content) 62 | htmlfile = open(htmlfilename, 'w') 63 | htmlfile.write(htmlstring) 64 | htmlfile.close() 65 | 66 | 67 | def generate_html_from_file(): 68 | """ 69 | Generates HTML Data based on datafilename's content 70 | """ 71 | old = read_data_file() 72 | generate_html_into_file(old) 73 | 74 | 75 | def generate_html_to_display_from_file(): 76 | """ 77 | Generates and Displays generated HTML 78 | """ 79 | old = read_data_file() 80 | htmlstring = generate_html(old) 81 | print htmlstring 82 | 83 | 84 | def read_data_file(): 85 | """ 86 | Reads Data file from datafilename given name 87 | """ 88 | datafile = open(datafilename, 'r') 89 | old = datafile.read() 90 | datafile.close() 91 | return old 92 | 93 | 94 | def process_form(name, indata, color, timestamp): 95 | """ 96 | Function for saving new Shoubox-Content & Regenerate static 97 | HTML file. 98 | -> usually called by HTML-Form 99 | """ 100 | content = save_input(name, indata, color, timestamp) 101 | 102 | if not broadcast_destination: 103 | generate_html_into_file(content) 104 | 105 | 106 | def save_input(name, indata, color, timestamp): 107 | """ 108 | Acutally saves SB-Content to datafile 109 | """ 110 | content = prepare_line(name, indata, color, timestamp) 111 | 112 | if broadcast_destination: 113 | return writeToNetwork(content, broadcast_destination) 114 | else: 115 | return writeToDisk(content) 116 | 117 | 118 | def writeToNetwork(content, broadcast_destination): 119 | message = messages.shoutbox_message() 120 | message.set(content) 121 | casting = broadcast.broadcast() 122 | casting.setDestination(broadcast_destination) 123 | casting.set(message.get_message()) 124 | casting.send() 125 | 126 | 127 | def writeToDisk(content): 128 | old = read_data_file() 129 | finalcontent = content + old 130 | datafile = open(datafilename, 'r+') 131 | datafile.write(finalcontent) 132 | #datafile.truncate(0) 133 | datafile.close() 134 | return finalcontent 135 | 136 | 137 | def prepare_line(name, indata, color, timestamp): 138 | name = html_escape(name) 139 | data = html_escape(indata) 140 | color = html_escape(color) 141 | if clienttimestamp == 'yes': 142 | curdate = datetime.datetime.fromtimestamp(timestamp) 143 | else: 144 | curdate = datetime.datetime.now() 145 | # Trying to make it look like this: 146 | #
147 | # 00:00:00 Nickname: 148 | # Lorem ipsum dolor sit amet 149 | #
150 | # 151 | content = "
%s %s: " \ 152 | "%s
\n" \ 153 | % (curdate.strftime("%H:%M:%S"), name, color, data) 154 | return content 155 | 156 | #-------------- 157 | # Testing or Generating static HTML File 158 | #-------------- 159 | if __name__ == "__main__": 160 | import sys 161 | if sys.argv.count("input") >= 1: 162 | save_input(sys.argv[2], sys.argv[3], sys.argv[4]) 163 | generate_html_to_display_from_file() 164 | print "Entered Text." 165 | 166 | generate_html_from_file() 167 | print "Generated HTML-Shoutbox File." 168 | -------------------------------------------------------------------------------- /piratebox/piratebox/python_lib/psutil.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | Return disk usage statistics about the given path as a (total, used, free) 5 | namedtuple. Values are expressed in bytes. 6 | """ 7 | # Author: Giampaolo Rodola' 8 | # License: MIT 9 | 10 | import os 11 | import collections 12 | 13 | _ntuple_diskusage = collections.namedtuple('usage', 'total used free') 14 | 15 | if hasattr(os, 'statvfs'): # POSIX 16 | def disk_usage(path): 17 | st = os.statvfs(path) 18 | free = st.f_bavail * st.f_frsize 19 | total = st.f_blocks * st.f_frsize 20 | used = (st.f_blocks - st.f_bfree) * st.f_frsize 21 | return _ntuple_diskusage(total, used, free) 22 | 23 | elif os.name == 'nt': # Windows 24 | import ctypes 25 | import sys 26 | 27 | def disk_usage(path): 28 | _, total, free = ctypes.c_ulonglong(), ctypes.c_ulonglong(), \ 29 | ctypes.c_ulonglong() 30 | if sys.version_info >= (3,) or isinstance(path, unicode): 31 | fun = ctypes.windll.kernel32.GetDiskFreeSpaceExW 32 | else: 33 | fun = ctypes.windll.kernel32.GetDiskFreeSpaceExA 34 | ret = fun(path, ctypes.byref(_), ctypes.byref(total), ctypes.byref(free)) 35 | if ret == 0: 36 | raise ctypes.WinError() 37 | used = total.value - free.value 38 | return _ntuple_diskusage(total.value, used, free.value) 39 | else: 40 | raise NotImplementedError("platform not supported") 41 | 42 | disk_usage.__doc__ = __doc__ 43 | 44 | if __name__ == '__main__': 45 | print disk_usage(os.getcwd()) -------------------------------------------------------------------------------- /piratebox/piratebox/python_lib/style.css: -------------------------------------------------------------------------------- 1 | date { font-size: 10pt; color: #666666; font-family:Tahoma } 2 | name { font-weight: bold; font-family:Tahoma } 3 | data { font-family: Tahoma } 4 | data.def { color: #000000 } 5 | data.blue { color: #0000FF } 6 | data.green { color: #008000 } 7 | data.orange { color: #FF8040 } 8 | data.red { color: #FF0000 } -------------------------------------------------------------------------------- /piratebox/piratebox/rpi/bin/do_switch_client.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Wrapper script for the steps to enable wifi client 4 | 5 | systemctl stop piratebox 6 | if /opt/piratebox/rpi/bin/run_client.sh ; then 7 | echo "Started Wifi client sucessfully!" 8 | exit 0 9 | else 10 | echo "Error while starting wifi client, restarting piratebox" 11 | systemctl start piratebox 12 | exit 1 13 | fi 14 | exit 1 15 | -------------------------------------------------------------------------------- /piratebox/piratebox/rpi/bin/run_client.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Runs with wpa_supplicant & wifi device from boot folder. 4 | 5 | ## Default 6 | WIFI_DEVICE="wlan0" 7 | 8 | WIFI_CONFIG_PATH="/boot/wifi_card.conf" 9 | WPA_SUPPLICANT="/boot/wpa_supplicant.conf" 10 | 11 | # Try to get wifi device 12 | if test -e "${WIFI_CONFIG_PATH}" ; then 13 | echo "Found wifi card config" 14 | WIFI_DEVICE=$( head -n 1 "${WIFI_CONFIG_PATH}" | tr -d '\n' ) 15 | fi 16 | 17 | # Try to connect to Wifi if wpa_supplicant.conf is available. 18 | if [ -f "${WPA_SUPPLICANT}" ]; then 19 | echo "Found wpa_supplicant conf, trying to connect..." 20 | wpa_supplicant -i"${WIFI_DEVICE}" -c "${WPA_SUPPLICANT}" -B -D wext 21 | dhcpcd "${WIFI_DEVICE}" 22 | exit 0 23 | else 24 | echo "Wifi configuration not found" 25 | exit 1 26 | fi 27 | exit 1 28 | -------------------------------------------------------------------------------- /piratebox/piratebox/rpi/bin/sdcard_share.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | 3 | # This script enables the SDCard as ext4 to be used as storage 4 | # it also activates some spare for swap 5 | 6 | MOUNTPOINT="/mnt/sdshare" 7 | FS="ext4" 8 | 9 | 10 | SDCARD="/dev/mmcblk0" 11 | 12 | if test -e "$SDCARD"p3 ; then 13 | echo "ERROR: SWAP already exists" 14 | exit 1 15 | fi 16 | 17 | if test -e "$SDCARD"p4 ; then 18 | echo "ERROR: Data partition already exists" 19 | exit 1 20 | fi 21 | 22 | echo "Creating partitions.." 23 | fdisk "$SDCARD" <> /etc/fstab 69 | 70 | echo "Creating data partition" 71 | mkfs.ext4 -F "$SDCARD"p4 72 | if [ $? -ne 0 ] ; then 73 | echo "Error formating data" 74 | exit 1 75 | fi 76 | 77 | DATA_UUID=$( blkid | grep "${SDCARD}p4.*TYPE=\"ext4\"" | egrep -o " UUID=\"([a-zA-Z0-9-])*\"" | sed 's/ //g' ) 78 | if grep -q "${DATA_UUID}" /etc/fstab ; then 79 | echo "Error: data is already configured in fstab" 80 | exit 1 81 | fi 82 | 83 | echo "${DATA_UUID} ${MOUNTPOINT} ext4 defaults,noatime,nodiratime,data=writeback 0 0 ">> /etc/fstab 84 | 85 | mkdir -p "${MOUNTPOINT}" 86 | mount "${MOUNTPOINT}" 87 | 88 | if [ $? -ne 0 ] ; then 89 | echo "ERROR mounting data partion" 90 | exit 1 91 | fi 92 | 93 | echo "## Moving files..." 94 | mv /opt/piratebox/share "${MOUNTPOINT}/share" > /dev/null 2>&1 95 | ln -s "${MOUNTPOINT}/share" /opt/piratebox/share > /dev/null 96 | 97 | 98 | # Force update diskwirte 99 | touch -t 197001010101 /opt/piratebox/www/diskusage.html 100 | wget http://127.0.0.1/cgi-bin/diskwrite.py -q -O - 101 | 102 | exit 0 103 | 104 | -------------------------------------------------------------------------------- /piratebox/piratebox/rpi/bin/starter.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Try to setup WiFi and if it succeeds, start the PirateBox 3 | 4 | ## Default 5 | WIFI_DEVICE="wlan0" 6 | 7 | WIFI_CONFIG_PATH="/boot/wifi_card.conf" 8 | 9 | if test -e "${WIFI_CONFIG_PATH}" ; then 10 | echo "Found wifi card config" 11 | WIFI_DEVICE=$( head -n 1 "${WIFI_CONFIG_PATH}" | tr -d '\n' ) 12 | fi 13 | 14 | 15 | if [ "${INTERFACE}" = "${WIFI_DEVICE}" ] ; then 16 | /bin/sh -c /opt/piratebox/rpi/bin/wifi_detect.sh && /usr/bin/systemctl start piratebox 17 | fi 18 | exit 0 19 | -------------------------------------------------------------------------------- /piratebox/piratebox/rpi/bin/switch_to_client.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # User friendly way to switch to client 4 | # Adds "nohup" option... 5 | 6 | nohup /opt/piratebox/rpi/bin/do_switch_client.sh 7 | -------------------------------------------------------------------------------- /piratebox/piratebox/rpi/bin/usb_share.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Find a vfat partition and configure it as an external share 4 | MOUNTPOINT="/mnt/usbshare" 5 | FS="vfat" 6 | UUIDS=$(blkid | grep "/dev/sd*.*TYPE=\"${FS}\"" | egrep -o " UUID=\"([a-zA-Z0-9-])*\"" | sed 's/ //g') 7 | 8 | if [ $(echo "${UUIDS}" | wc -l) -gt 1 ]; then 9 | echo "You seem to have more than one valid ${FS} partition for a USB share:" 10 | echo "${UUIDS}\n" 11 | echo "Please make sure you have a USB thumb drive attached with a single ${FS} partition." 12 | exit 1 13 | fi 14 | 15 | if [ $(echo "${UUIDS}" | wc -l) -lt 1 ] || [[ $UUIDS == "" ]]; then 16 | echo "You seem to have no valid ${FS} partition for a USB share." 17 | echo "Please make sure you have a USB thumb drive attached with a single ${FS} partition." 18 | exit 1 19 | fi 20 | 21 | UUID=$(echo "${UUIDS}" | cut -f2 -d" " | sed s/"\""/""/g) 22 | grep "${UUID}" /etc/fstab > /dev/null 23 | if [ $? -eq 0 ]; then 24 | echo "Error: This disk is already configured as an USB share..." 25 | exit 1 26 | fi 27 | 28 | echo "## Adding USB share..." 29 | mkdir -p "${MOUNTPOINT}" > /dev/null 30 | echo "${UUID} ${MOUNTPOINT} vfat umask=0,noatime,rw,user,uid=nobody,gid=nogroup 0 0" >> /etc/fstab 31 | mount "${MOUNTPOINT}" > /dev/null 32 | 33 | if [ $? == 0 ]; then 34 | echo "## Moving files..." 35 | mv /opt/piratebox/share "${MOUNTPOINT}/share" > /dev/null 2>&1 36 | ln -s "${MOUNTPOINT}/share" /opt/piratebox/share > /dev/null 37 | else 38 | echo "Error: Mounting file system failed, will not move files..." 39 | cat "/etc/fstab" 40 | fi 41 | 42 | # Force update diskwirte 43 | touch -t 201701010101 /opt/piratebox/www/diskusage.html 44 | wget http://127.0.0.1/cgi-bin/diskwrite.py -q -O - 45 | 46 | exit 0 47 | -------------------------------------------------------------------------------- /piratebox/piratebox/rpi/bin/wifi_detect.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Install the proper hostapd package and adjust the hostapd configuration 4 | # accordingly. 5 | 6 | ## Default 7 | WIFI_DEVICE="wlan0" 8 | 9 | WIFI_CONFIG_PATH="/boot/wifi_card.conf" 10 | 11 | PACKAGE_PATH="/prebuild/hostapd" 12 | CONFIG_PATH="/opt/piratebox/conf/hostapd.conf" 13 | PIRATEBOX_CONFIG_PATH="/opt/piratebox/conf/piratebox.conf" 14 | 15 | ## Only use if it is set 16 | if test -e "${WIFI_CONFIG_PATH}" ; then 17 | echo "Found wifi card config" 18 | WIFI_DEVICE=$( head -n 1 "${WIFI_CONFIG_PATH}" | tr -d '\n' ) 19 | fi 20 | 21 | hostap_interface=$( grep -e '^interface' "${CONFIG_PATH}" | sed -e 's|interface=||' ) 22 | piratebox_interface=$( grep -e '^INTERFACE' "${PIRATEBOX_CONFIG_PATH}" | \ 23 | sed -e 's|INTERFACE=||' -e 's|"||g' ) 24 | dnsmasq_interface=$( grep -e '^DNSMASQ_INTERFACE' "${PIRATEBOX_CONFIG_PATH}" | \ 25 | sed -e 's|DNSMASQ_INTERFACE=||' -e 's|"||g' ) 26 | 27 | sed -i -e "s|interface=$hostap_interface|interface=$WIFI_DEVICE|" "${CONFIG_PATH}" 28 | 29 | #Only change piratebox interface if it is a wifi interface 30 | if echo "$piratebox_interface" | grep -q "wlan" ; then 31 | sed -i -e "s|INTERFACE=\"$piratebox_interface\"|INTERFACE=\"$WIFI_DEVICE\"|" \ 32 | "${PIRATEBOX_CONFIG_PATH}" 33 | fi 34 | if echo "$dnsmasq_interface" | grep -q "wlan" ; then 35 | sed -i -e "s|DNSMASQ_INTERFACE=\"$dnsmasq_interface\"|DNSMASQ_INTERFACE=\"$WIFI_DEVICE\"|" \ 36 | "${PIRATEBOX_CONFIG_PATH}" 37 | fi 38 | 39 | 40 | 41 | ## Get pyhX device node 42 | CARD_ID=$( cat /sys/class/net/"${WIFI_DEVICE}"/phy80211/index ) 43 | 44 | 45 | # Check if we have an nl80211 enabled device with AP mode, then we are done 46 | if iw phy phy"${CARD_ID}" info | grep -q "* AP$"; then 47 | echo "Found nl80211 device capable of AP mode..." 48 | pacman --noconfirm -U --needed "${PACKAGE_PATH}/hostapd-2"* > /dev/null 49 | sed -i 's/^#driver=nl80211/driver=nl80211/' "${CONFIG_PATH}" 50 | exit 0 51 | fi 52 | 53 | #Get driver name 54 | DRIVER_NAME=$( ls -1 /sys/class/net/"${WIFI_DEVICE}"/device/driver/module/drivers/ ) 55 | 56 | # Check for r8188eu enabled device 57 | if echo "$DRIVER_NAME" | grep -q "r8188eu"; then 58 | echo "Found r8188eu enabled device..." 59 | pacman --noconfirm -U --needed "${PACKAGE_PATH}/hostapd-8188eu-"* > /dev/null 60 | sed -i 's/^driver=nl80211/#driver=nl80211/' "${CONFIG_PATH}" 61 | exit 0 62 | fi 63 | 64 | 65 | # Check for rtl8192cu enabled device 66 | if echo "$DRIVER_NAME" | grep -q "rtl8192cu"; then 67 | echo "Found rtl8192cu enabled device..." 68 | pacman --noconfirm -U --needed "${PACKAGE_PATH}/hostapd-8192cu-"* > /dev/null 69 | sed -i 's/^driver=nl80211/#driver=nl80211/' "${CONFIG_PATH}" 70 | exit 0 71 | fi 72 | 73 | echo "Could not find an AP enabled WiFi card..." 74 | 75 | # Try to connect to Wifi if wpa_supplicant.conf is available. 76 | if [ -f /boot/wpa_supplicant.conf ]; then 77 | /opt/piratebox/rpi/bin/run_client.sh 78 | exit 1 79 | # Exit =! 0 will result in not starting piratebox service 80 | fi 81 | 82 | exit 1 83 | -------------------------------------------------------------------------------- /piratebox/piratebox/rpi/services/piratebox.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=PirateBox Service 3 | 4 | [Service] 5 | Type=idle 6 | RemainAfterExit=yes 7 | ExecStart=/opt/piratebox/init.d/piratebox_alt start 8 | ExecStop=/opt/piratebox/init.d/piratebox_alt stop 9 | #Restart=/opt/piratebox/init.d/piratebox_alt restart 10 | #PIDFile=/var/run/piratebox.pid 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | 15 | -------------------------------------------------------------------------------- /piratebox/piratebox/rpi/services/rpi_hwclock.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=rpi_hwclock initialization and sync 3 | After=multi-user.target 4 | 5 | [Service] 6 | Type=idle 7 | ExecStart=/opt/piratebox/bin/rpi_hwclock.sh 8 | 9 | [Install] 10 | WantedBy=multi-user.target 11 | -------------------------------------------------------------------------------- /piratebox/piratebox/rpi/services/timesave.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=PirateBox timesave service 3 | 4 | [Service] 5 | Type=oneshot 6 | RemainAfterExit=true 7 | ExecStart=/opt/piratebox/bin/timesave.sh /opt/piratebox/conf/piratebox.conf recover 8 | ExecStop=/opt/piratebox/bin/timesave.sh /opt/piratebox/conf/piratebox.conf save 9 | TimeoutSec=20 10 | 11 | [Install] 12 | WantedBy=multi-user.target 13 | -------------------------------------------------------------------------------- /piratebox/piratebox/rpi/udev/99-wifi.rules: -------------------------------------------------------------------------------- 1 | KERNEL=="wlan*", RUN+="/bin/sh -c /opt/piratebox/rpi/bin/starter.sh" 2 | -------------------------------------------------------------------------------- /piratebox/piratebox/share/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PirateBox-Dev/PirateBoxScripts_Webserver/25621d780cc27df4ca5b647a303332709c3aa2ab/piratebox/piratebox/share/.keep -------------------------------------------------------------------------------- /piratebox/piratebox/src/HEADER.txt: -------------------------------------------------------------------------------- 1 | 2 | PirateBox - Share Freely! 3 | 4 | 5 | 6 | 7 | 27 |
28 |
29 | -------------------------------------------------------------------------------- /piratebox/piratebox/src/README.txt: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 |

Back to top

7 |

About PirateBox

8 |

Inspired by pirate radio and the free culture movement, PirateBox is a self-contained mobile collaboration and file sharing device. PirateBox utilizes Free, Libre and Open Source software (FLOSS) to create mobile wireless file sharing networks where users can anonymously share images, video, audio, documents, and other digital content.

9 |

PirateBox is designed to be safe and secure. No logins are required and no user data is logged. The system is purposely not connected to the Internet in order to prevent tracking and preserve user privacy.

10 | PirateBox is licensed under GPLv3. 11 |
12 |
13 | -------------------------------------------------------------------------------- /piratebox/piratebox/src/forest.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Arial, sans-serif; 3 | font-size: 10pt; 4 | } 5 | 6 | a { 7 | font-weight: bold; 8 | text-decoration: none; 9 | color: #009900; 10 | } 11 | 12 | a:hover { 13 | color: #00EE00; 14 | } 15 | 16 | form { 17 | background-color: #EEEEEE; 18 | } 19 | 20 | .threads_table { 21 | font-size: 10pt; 22 | } 23 | 24 | .threads_header { 25 | background-color: #009900; 26 | color: white; 27 | } 28 | 29 | .thread_header { 30 | background-color: #009900; 31 | color: white; 32 | font-weight: bold; 33 | font-size: 110%; 34 | } 35 | 36 | .thread_row { 37 | background-color: #dddddd; 38 | } 39 | .thread_row_alt { 40 | background-color: #eeeeee; 41 | } 42 | 43 | .submit_button { 44 | border: solid 1px black; 45 | background: #00AA00; 46 | color: white; 47 | font-weight: bold; 48 | } 49 | 50 | .error { 51 | color: red; 52 | } 53 | 54 | .copy { 55 | font-size: 8pt; 56 | text-align: center; 57 | } 58 | 59 | #hidden_form { 60 | display: none; 61 | } 62 | 63 | .board_description { 64 | -moz-border-radius: 8px; 65 | padding: 5px; 66 | background-color: #eeeeee; 67 | border: 2px solid #dddddd; 68 | } 69 | 70 | .date { 71 | font-size: 85%; 72 | } 73 | -------------------------------------------------------------------------------- /piratebox/piratebox/src/kareha.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -wT 2 | 3 | use strict; 4 | use CGI; 5 | use CGI::Carp qw ( fatalsToBrowser ); 6 | use File::Basename; 7 | 8 | my $query = new CGI; 9 | 10 | print $query->header ( ); 11 | print "Sorry, no Board is installed"; 12 | 13 | 1; 14 | -------------------------------------------------------------------------------- /piratebox/piratebox/src/kareha_img_config.pl: -------------------------------------------------------------------------------- 1 | # 2 | # Example config file. 3 | # 4 | # Uncomment and edit the options you want to specifically change from the 5 | # default values. You must specify ADMIN_PASS and SECRET. 6 | # 7 | 8 | # System config 9 | #use constant ADMIN_PASS => 'xyzPASSWORDzyx'; # Admin password. For fucks's sake, change this. 10 | #use constant SECRET => 'xyzSECRETCODEzyx'; # Cryptographic secret. CHANGE THIS to something totally random, and long. 11 | #use constant CAPPED_TRIPS => ('!!example1'=>' capcode','!!example2'=>' cap'); # Admin tripcode hash, for startng threads when locked down, and similar. Format is '!trip'=>'capcode', where 'capcode' is what is shown instead of the trip. This can contain HTML, but keep it valid XHTML! 12 | 13 | # Page look 14 | use constant TITLE => 'PirateBox board'; # Name of this image board 15 | use constant SHOWTITLETXT => 1; # Show TITLE at top (1: yes 0: no) 16 | use constant SHOWTITLEIMG => 1; # Show image at top (0: no, 1: single, 2: rotating) 17 | use constant TITLEIMG => '/content/img/piratebox-logo-small.png'; # Title image (point to a script file if rotating) 18 | #use constant THREADS_DISPLAYED => 10; # Number of threads on the front page 19 | #use constant THREADS_LISTED => 40; # Number of threads in the thread list 20 | #use constant REPLIES_PER_THREAD => 10; # Replies shown 21 | #use constant S_ANONAME => 'Anonymous'; # Defines what to print if there is no text entered in the name field 22 | #use constant DEFAULT_STYLE => 'Futaba'; # Default CSS style title 23 | use constant FAVICON => '/favicon.ico'; # Path to the favicon for the board 24 | 25 | # Limitations 26 | use constant ALLOW_TEXT_THREADS => 1; # Allow users to create text threads 27 | use constant ALLOW_TEXT_REPLIES => 1; # Allow users to make text replies 28 | #use constant AUTOCLOSE_POSTS => 0; # Maximum number of posts before a thread closes. 0 to disable. 29 | #use constant AUTOCLOSE_DAYS => 0; # Maximum number of days with no activity before a thread closes. 0 to disable. 30 | #use constant AUTOCLOSE_SIZE => 0; # Maximum size of the thread HTML file in kilobytes before a thread closes. 0 to disable. 31 | #use constant MAX_RES => 20; # Maximum topic bumps 32 | #use constant MAX_THREADS => 0; # Maximum number of threads - set to 0 to disable 33 | #use constant MAX_POSTS => 500; # Maximum number of posts - set to 0 to disable 34 | #use constant MAX_MEGABYTES => 0; # Maximum size to use for all images in megabytes - set to 0 to disable 35 | #use constant MAX_FIELD_LENGTH => 100; # Maximum number of characters in subject, name, and email 36 | #use constant MAX_COMMENT_LENGTH => 8192; # Maximum number of characters in a comment 37 | #use constant MAX_LINES_SHOWN => 15; # Max lines of a comment shown on the main page (0 = no limit) 38 | #use constant ALLOW_ADMIN_EDIT => 0; # Allow editing of include files and spam.txt from admin.pl. 39 | # Warning! This is a security risk, since include templates can run code! Only enable if you completely trust your moderators! 40 | 41 | # Image posts 42 | #use constant ALLOW_IMAGE_THREADS => 1; # Allow users to create image threads 43 | #use constant ALLOW_IMAGE_REPLIES => 1; # Allow users to make image replies 44 | #use constant IMAGE_REPLIES_PER_THREAD => 0; # Number of image replies per thread to show, set to 0 for no limit. 45 | use constant MAX_KB => 5000; # Maximum upload size in KB 46 | #use constant MAX_W => 200; # Images exceeding this width will be thumbnailed 47 | #use constant MAX_H => 200; # Images exceeding this height will be thumbnailed 48 | #use constant THUMBNAIL_SMALL => 1; # Thumbnail small images (1: yes, 0: no) 49 | #use constant THUMBNAIL_QUALITY => 70; # Thumbnail JPEG quality 50 | use constant ALLOW_UNKNOWN => 0; # Allow unknown filetypes (1: yes, 0: no) 51 | use constant MUNGE_UNKNOWN => '.unknown'; # Munge unknown file type extensions with this. If you remove this, make sure your web server is locked down properly. 52 | use constant FORBIDDEN_EXTENSIONS => ('php','php3','php4','phtml','shtml','cgi','pl','pm','py','r','exe','dll','scr','pif','asp','cfm','jsp','vbs'); # file extensions which are forbidden 53 | use constant STUPID_THUMBNAILING => 1; # Bypass thumbnailing code and just use HTML to resize the image. STUPID, wastes bandwidth. (1: enable, 0: disable) 54 | #use constant MAX_IMAGE_WIDTH => 16384; # Maximum width of image before rejecting 55 | #use constant MAX_IMAGE_HEIGHT => 16384; # Maximum height of image before rejecting 56 | #use constant MAX_IMAGE_PIXELS => 50000000; # Maximum width*height of image before rejecting 57 | #use constant CONVERT_COMMAND => 'convert'; # location of the ImageMagick convert command (usually just 'convert', but sometime a full path is needed) 58 | 59 | # Captcha 60 | #use constant ENABLE_CAPTCHA => 0; # Enable verification codes (0: disabled, 1: enabled) 61 | #use constant CAPTCHA_HEIGHT => 18; # Approximate height of captcha image 62 | #use constant CAPTCHA_SCRIBBLE => 0.2; # Scribbling factor 63 | #use constant CAPTCHA_SCALING => 0.15; # Randomized scaling factor 64 | #use constant CAPTCHA_ROTATION => 0.3; # Randomized rotation factor 65 | #use constant CAPTCHA_SPACING => 2.5; # Letter spacing 66 | 67 | # Tweaks 68 | #use constant CHARSET => 'utf-8'; # Character set to use, typically "utf-8" or "shift_jis". Remember to set Apache to use the same character set for .html files! (AddCharset shift_jis html) 69 | #use constant PROXY_CHECK => (); # Ports to scan for proxies - NOT IMPLEMENTED. 70 | #use constant TRIM_METHOD => 0; # Which threads to trim (0: oldest - like futaba 1: least active - furthest back) 71 | #use constant REQUIRE_THREAD_TITLE => 0; # Require a title for threads (0: no, 1: yes) 72 | #use constant DATE_STYLE => 'futaba'; # Date style ('2ch', 'futaba', 'localtime, 'http') 73 | use constant DISPLAY_ID => 'day'; # How to display user IDs (0 or '': don't display, 74 | # 'day', 'thread', 'board' in any combination: make IDs change for each day, thread or board, 75 | # 'mask': display masked IP address (similar IPs look similar, but are still encrypted) 76 | # 'sage': don't display ID when user sages, 'link': don't display ID when the user fills out the link field, 77 | # 'ip': display user's IP, 'host': display user's host) 78 | #use constant EMAIL_ID => 'Heaven'; # Replace the ID with this string when the user uses an email. Set to '' to disable. 79 | #use constant SILLY_ANONYMOUS => ''; # Make up silly names for anonymous people (same syntax as DISPLAY_ID) 80 | #use constant FORCED_ANON => 0; # Force anonymous posting (0: no, 1: yes) 81 | #use constant TRIPKEY => '!'; # This character is displayed before tripcodes 82 | #use constant ALTERNATE_REDIRECT => 0; # Use alternate redirect method. (Javascript/meta-refresh instead of HTTP forwards.) 83 | #use constant APPROX_LINE_LENGTH => 150; # Approximate line length used by reply abbreviation code to guess at the length of a reply. 84 | #use constant COOKIE_PATH => 'root'; # Path argument for cookies ('root': cookies apply to all boards on the site, 'current': cookies apply only to this board, 'parent': cookies apply to all boards in the parent directory) - does NOT apply to the style cookie! 85 | #use constant STYLE_COOKIE => 'wakabastyle'; # Cookie name for the style selector. 86 | #use constant ENABLE_DELETION => 1; # Enable user deletion of posts. (0: no, 1: yes) 87 | #use constant PAGE_GENERATION => 'paged'; # Page generation method ('single': just one page, 'paged': split into several pages like futaba, 'monthly': separate pages for each month) 88 | #use constant DELETE_FIRST => 'remove'; # What to do when the first post is deleted ('keep': keep the thread, 'single': delete the thread if there is only one post, 'remove': delete the whole thread) 89 | #use constant DEFAULT_MARKUP => 'waka'; # Default markup format ('none', 'waka', 'html', 'aa') 90 | #use constant FUDGE_BLOCKQUOTES => 1; # Modify formatting for old stylesheets 91 | #use constant USE_XHTML => 1; # Send pages as application/xhtml+xml to browsers that support this (0:no, 1:yes) 92 | #use constant KEEP_MAINPAGE_NEWLINES => 0; # Don't strip whitespace from main page (needed for Google ads to work, 0:no, 1:yes) 93 | #use constant SPAM_TRAP => 1; # Enable the spam trap (empty, hidden form fields that spam bots usually fill out) (0:no, 1:yes) 94 | 95 | # Internal paths and files - might as well leave this alone. 96 | #use constant RES_DIR => 'res/'; # Reply cache directory (needs to be writeable by the script) 97 | #use constant CSS_DIR => 'css/'; # CSS file directory 98 | #use constant IMG_DIR => 'src/'; # Image directory (needs to be writeable by the script) 99 | #use constant THUMB_DIR => 'thumb/'; # Thumbnail directory (needs to be writeable by the script) 100 | #use constant INCLUDE_DIR => 'include/'; # Include file directory 101 | #use constant LOG_FILE => 'log.txt'; # Log file (stores delete passwords and IP addresses in encrypted form) 102 | #use constant PAGE_EXT => '.html'; # Extension used for board pages after first 103 | #use constant HTML_SELF => 'index.html'; # Name of main html file 104 | #use constant HTML_BACKLOG => ''; # Name of backlog html file 105 | #use constant RSS_FILE => ''; # RSS file. Set to '' to disable RSS support. 106 | #use constant JS_FILE => 'kareha.js'; # Location of the js file 107 | #use constant SPAM_FILES => ('spam.txt'); # Spam definition files, as a Perl list. 108 | # Hints: * Set all boards to use the same file for easy updating. 109 | # * Set up two files, one being the official list from 110 | # http://wakaba.c3.cx/antispam/spam.txt, and one your own additions. 111 | 112 | # Admin script options 113 | #use constant ADMIN_SHOWN_LINES => 5; # Number of post lines the admin script shows. 114 | #use constant ADMIN_SHOWN_POSTS => 10; # Number of posts per thread the admin script shows. 115 | #use constant ADMIN_MASK_IPS => 0; # Mask poster IP addresses in the admin script (0: no, 1: yes) 116 | #use constant ADMIN_EDITABLE_FILES => (SPAM_FILES); # A Perl list of all files that can be edited from the admin script. 117 | # Hints: * If you don't trust your moderators, don't let them edit templates! 118 | # Templates can execute code on your server! 119 | # * If you still want to allow editing of templates, use 120 | # (SPAM_FILES,glob("include/*")) as a convenient shorthand. 121 | #use constant ADMIN_BAN_FILE => '.htaccess'; # Name of the file to write bans to 122 | #use constant ADMIN_BAN_TEMPLATE => "\n# Banned at ()\nDeny from \n"; 123 | # Format of the ban entries, using the template syntax. 124 | 125 | 126 | # Icons for filetypes - file extensions specified here will not be renamed, and will get icons 127 | # (except for the built-in image formats). These example icons can be found in the extras/ directory. 128 | use constant FILETYPES => ( 129 | # # Audio files 130 | mp3 => 'icons/audio-mp3.png', 131 | ogg => 'icons/audio-ogg.png', 132 | aac => 'icons/audio-aac.png', 133 | m4a => 'icons/audio-aac.png', 134 | mpc => 'icons/audio-mpc.png', 135 | mpp => 'icons/audio-mpp.png', 136 | mod => 'icons/audio-mod.png', 137 | it => 'icons/audio-it.png', 138 | xm => 'icons/audio-xm.png', 139 | fla => 'icons/audio-flac.png', 140 | flac => 'icons/audio-flac.png', 141 | sid => 'icons/audio-sid.png', 142 | mo3 => 'icons/audio-mo3.png', 143 | spc => 'icons/audio-spc.png', 144 | nsf => 'icons/audio-nsf.png', 145 | # Archive files 146 | zip => 'icons/archive-zip.png', 147 | rar => 'icons/archive-rar.png', 148 | lzh => 'icons/archive-lzh.png', 149 | lha => 'icons/archive-lzh.png', 150 | gz => 'icons/archive-gz.png', 151 | bz2 => 'icons/archive-bz2.png', 152 | '7z' => 'icons/archive-7z.png', 153 | # Other files 154 | swf => 'icons/flash.png', 155 | torrent => 'icons/torrent.png', 156 | # To stop Wakaba from renaming image files, put their names in here like this: 157 | # gif => '.', 158 | # jpg => '.', 159 | # png => '.', 160 | ); 161 | 162 | # Allowed HTML tags and attributes. Sort of undocumented for now, but feel free to 163 | # learn by example. 164 | #use constant ALLOWED_HTML => ( 165 | # 'a'=>{args=>{'href'=>'url'},forced=>{'rel'=>'nofollow'}}, 166 | # 'b'=>{},'i'=>{},'u'=>{},'sub'=>{},'sup'=>{}, 167 | # 'em'=>{},'strong'=>{}, 168 | # 'ul'=>{},'ol'=>{},'li'=>{},'dl'=>{},'dt'=>{},'dd'=>{}, 169 | # 'p'=>{},'br'=>{empty=>1},'blockquote'=>{}, 170 | #); 171 | 172 | 173 | 1; 174 | -------------------------------------------------------------------------------- /piratebox/piratebox/src/linux.example.minidlna.conf: -------------------------------------------------------------------------------- 1 | port=8200 2 | # Adjust the interfaces u are using 3 | # network_interface=wlan0 4 | friendly_name=PirateBox DLNA 5 | db_dir=/opt/piratebox/tmp 6 | log_dir=/opt/piratebox/tmp 7 | inotify=yes 8 | enable_tivo=no 9 | strict_dlna=no 10 | album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg 11 | presentation_url=http://piratebox.lan 12 | notify_interval=900 13 | serial=12345678 14 | model_number=1 15 | root_container=B 16 | media_dir=/opt/piratebox/share/Shared 17 | 18 | -------------------------------------------------------------------------------- /piratebox/piratebox/src/no_forum.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | The kareha imageboard is not fully configured.
4 |
5 | Visit the following Link to do the initial configuration. 6 |
7 |
8 | Or go back to PirateBox start page. 9 | 10 | 11 | -------------------------------------------------------------------------------- /piratebox/piratebox/src/no_link.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PirateBox-Dev/PirateBoxScripts_Webserver/25621d780cc27df4ca5b647a303332709c3aa2ab/piratebox/piratebox/src/no_link.html -------------------------------------------------------------------------------- /piratebox/piratebox/src/openwrt.example.minidlna: -------------------------------------------------------------------------------- 1 | config minidlna config 2 | option 'enabled' '1' 3 | option port '8200' 4 | option interface 'br-lan' 5 | option friendly_name 'PirateBox DLNA' 6 | option db_dir '/opt/piratebox/share/minidlna' 7 | option log_dir '/var/log' 8 | option inotify '1' 9 | option enable_tivo '0' 10 | option strict_dlna '0' 11 | option presentation_url 'http://piratebox.lan' 12 | option notify_interval '900' 13 | option serial '12345678' 14 | option model_number '1' 15 | option root_container '.' 16 | list media_dir '/mnt/usb/PirateBox/Shared/' 17 | option album_art_names 'Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg' 18 | -------------------------------------------------------------------------------- /piratebox/piratebox/src/redirect.html.schema: -------------------------------------------------------------------------------- 1 | 2 | Redirect... 3 | 4 | 5 | 6 | 7 | 8 | 9 | Redirect 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /piratebox/piratebox/tmp/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PirateBox-Dev/PirateBoxScripts_Webserver/25621d780cc27df4ca5b647a303332709c3aa2ab/piratebox/piratebox/tmp/.keep -------------------------------------------------------------------------------- /piratebox/piratebox/www/.READ.ME.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | READ ME 5 | 13 | 14 | 15 | 16 | 17 | 18 |

19 | 20 | 21 | 22 |

23 | 24 | 25 | 26 | 27 | 33 | 34 | 35 |

Inspired by pirate radio and the free culture movment, PirateBox is a self-contained mobile collaboration and file sharing device. PirateBox utilizes Free, Libre and Open Source software (FLOSS) to create mobile wireless file sharing networks where users can anonymously share images, video, audio, documents, and other digital content. 28 |

29 | PirateBox is designed to be safe and secure. No logins are required and no user data is logged. The system is purposely not connected to the Internet in order to prevent tracking and preserve user privacy. 30 |

31 | PirateBox was created by David Darts and is registered under a Free Art License (2011). To learn more about the project or to find out how to build your own PirateBox system, please visit http://daviddarts.com/piratebox 32 |


36 | 37 | 38 |

39 |

40 | 43 |
44 |

45 | -------------------------------------------------------------------------------- /piratebox/piratebox/www/cgi-bin/data.pso: -------------------------------------------------------------------------------- 1 |
09:52:54 Anonymous:ttttttttt
2 |
09:52:25 Anonymous:ttt
3 |
09:32:38 Anonymous:test
4 | -------------------------------------------------------------------------------- /piratebox/piratebox/www/cgi-bin/diskwrite.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Disk Write 4 | # Writes the total freespace to an HTML file. 5 | 6 | import cgi, datetime 7 | from diskusage import get_usage 8 | 9 | 10 | print "Content-type:text/html\r\n\r\n" 11 | 12 | get_usage("/opt/piratebox/share/Shared/") 13 | 14 | print """ok""" 15 | -------------------------------------------------------------------------------- /piratebox/piratebox/www/cgi-bin/psoread.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # PyShoutOut by Joey C. (http://www.joeyjwc.x3fusion.com) 4 | # Read the data from a shout-out file. 5 | 6 | 7 | # Changed by Matthias Strubel / 2011-02-27 for piratebox-path 8 | 9 | from psogen import generate_html_to_display_from_file 10 | 11 | print "Content-type:text/html\r\n\r\n" 12 | 13 | generate_html_to_display_from_file() 14 | -------------------------------------------------------------------------------- /piratebox/piratebox/www/cgi-bin/psowrte.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # PyShoutOut by Joey C. (http://www.joeyjwc.x3fusion.com) 4 | # Writes the recieved information to the data file. 5 | import cgi 6 | from psogen import process_form 7 | 8 | 9 | print "Content-type:text/html\r\n\r\n" 10 | 11 | values = cgi.FieldStorage() 12 | if "name" in values: 13 | rawname = values["name"].value 14 | else: 15 | rawname = " " 16 | if "data" in values: 17 | rawdata = values["data"].value 18 | else: 19 | rawdata = " " 20 | 21 | color = values["color"].value 22 | timestamp = float(values["timestamp"].value) 23 | 24 | process_form(rawname, rawdata, color, timestamp) 25 | 26 | print "Status:200\r\n\r\n" 27 | print """ok""" 28 | -------------------------------------------------------------------------------- /piratebox/piratebox/www/cgi-bin/style.css: -------------------------------------------------------------------------------- 1 | date { font-size: 10pt; color: #666666; font-family:Tahoma } 2 | name { font-weight: bold; font-family:Tahoma } 3 | data { font-family: Tahoma } 4 | data.def { color: #000000 } 5 | data.blue { color: #0000FF } 6 | data.green { color: #008000 } 7 | data.orange { color: #FF8040 } 8 | data.red { color: #FF0000 } -------------------------------------------------------------------------------- /piratebox/piratebox/www/generate_204: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /piratebox/piratebox/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | Redirect... 3 | 4 | 5 | 6 | 7 | 8 | 9 | Redirect 10 | 11 | 12 | -------------------------------------------------------------------------------- /piratebox/piratebox/www/library/test/success.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Success 5 | 6 | 7 | Success 8 | 9 | 10 | -------------------------------------------------------------------------------- /piratebox/piratebox/www/ncsi.txt: -------------------------------------------------------------------------------- 1 | Microsoft NCSI 2 | -------------------------------------------------------------------------------- /piratebox/piratebox/www/station_cnt.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PirateBox-Dev/PirateBoxScripts_Webserver/25621d780cc27df4ca5b647a303332709c3aa2ab/piratebox/piratebox/www/station_cnt.txt -------------------------------------------------------------------------------- /piratebox/piratebox/www/upload_handler/files/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !.htaccess 4 | -------------------------------------------------------------------------------- /piratebox/piratebox/www_content/css/page_style.css: -------------------------------------------------------------------------------- 1 | * { 2 | overflow: auto; 3 | -webkit-box-sizing: border-box; 4 | -moz-box-sizing: border-box; 5 | box-sizing: border-box; 6 | margin: 0; 7 | padding: 0; 8 | } 9 | 10 | html, body, div, object, iframe, fieldset { 11 | border: 0; 12 | } 13 | 14 | ol, ul { 15 | list-style: none; 16 | } 17 | 18 | table { 19 | border-spacing: 0; 20 | border-collapse: collapse; 21 | } 22 | 23 | header, footer, footer, nav, section, article, hgroup, figure { 24 | display: block; 25 | } 26 | 27 | legend { 28 | display: none; 29 | } 30 | 31 | body { 32 | color: #1b1d1e; 33 | font-family: sans-serif; 34 | font-size: 100%; 35 | } 36 | 37 | h1 { 38 | font-size: 1em; 39 | font-weight: bold; 40 | line-height: auto; 41 | margin: 0; 42 | } 43 | 44 | h2 { 45 | font-size: 1.3em; 46 | font-weight: bold; 47 | line-height: auto; 48 | margin: 0 0 0.25em; 49 | } 50 | 51 | h3 { 52 | font-size: 1em; 53 | font-weight: bold; 54 | line-height: auto; 55 | margin: 0 0 0.25em; 56 | } 57 | 58 | p { 59 | font-size: 1em; 60 | font-weight: normal; 61 | line-height: 1.5em; 62 | margin: 0 0 1em; 63 | } 64 | 65 | a { 66 | color: #ad000b; 67 | text-decoration: none; 68 | } 69 | 70 | a:hover { 71 | text-decoration: underline; 72 | } 73 | 74 | .current { 75 | color: white; 76 | } 77 | 78 | #top-nav a { 79 | display: block; 80 | font-size: 1.5em; 81 | font-weight: normal; 82 | line-height: 1.5em; 83 | margin: 0; 84 | } 85 | 86 | input { 87 | font-size: .75em; 88 | } 89 | 90 | label { 91 | color: white; 92 | font-size: .75em; 93 | } 94 | 95 | footer { 96 | color: #e7e9ea; 97 | } 98 | 99 | .message date { 100 | font-size: .625em; 101 | color: #979ea1; 102 | } 103 | .message name { 104 | font-size: .75em; 105 | font-weight: bold; 106 | } 107 | .message data { 108 | font-size: .75em; 109 | } 110 | 111 | .red { 112 | color: red; 113 | } 114 | 115 | .green { 116 | color: green; 117 | } 118 | 119 | .blue { 120 | color: blue; 121 | } 122 | 123 | .orange { 124 | color: #ff8040; 125 | } 126 | 127 | body { 128 | background: #e7e9ea; 129 | } 130 | 131 | header, footer { 132 | background: #1b1d1e; 133 | } 134 | header img, footer img { 135 | vertical-align: bottom; 136 | } 137 | 138 | #logo { 139 | background-image: url('/content/img/piratebox-logo-horizontal-white.png'); 140 | width: 215px; 141 | height: 36px; 142 | float: left; 143 | overflow: hidden; 144 | } 145 | 146 | #menu-icon { 147 | background-image: url('/content/img/menu.png'); 148 | float: right; 149 | width: 36px; 150 | height: 36px; 151 | overflow: hdden; 152 | -webkit-transition: all 0.5s ease-in-out; 153 | -moz-transition: all 0.5s ease-in-out; 154 | -o-transition: all 0.5s ease-in-out; 155 | transition: all 0.5s ease-in-out; 156 | } 157 | 158 | .rotate { 159 | -webkit-transform: rotate(-90deg); 160 | -moz-transform: rotate(-90deg); 161 | -ms-transform: rotate(-90deg); 162 | -o-transform: rotate(-90deg); 163 | transform: rotate(-90deg); 164 | -webkit-transition: all 0.5s ease-in-out; 165 | -moz-transition: all 0.5s ease-in-out; 166 | -o-transition: all 0.5s ease-in-out; 167 | transition: all 0.5s ease-in-out; 168 | } 169 | 170 | #top-nav { 171 | clear: both; 172 | display: none; 173 | padding: 1em 0 0 0; 174 | } 175 | 176 | #thanks { 177 | float: right; 178 | } 179 | 180 | #upload iframe { 181 | border: 1px solid #979ea1; 182 | border-radius: 3px; 183 | margin: 0 0 1em; 184 | } 185 | 186 | #shoutbox { 187 | height: 350px; 188 | overflow: auto; 189 | width: 100%; 190 | border: 1px solid #979ea1; 191 | border-radius: 3px; 192 | margin: 0 0 1em; 193 | padding: 0.5em; 194 | } 195 | #shoutbox .message { 196 | margin: 0 0 .25em 0; 197 | } 198 | 199 | #shoutbox-input { 200 | margin: 0 0 1em 0; 201 | } 202 | #shoutbox-input .nickname, 203 | #shoutbox-input .message, 204 | #shoutbox-input .button { 205 | width: 100%; 206 | } 207 | 208 | #shoutbox-options label { 209 | float: left; 210 | overflow: hidden; 211 | border-radius: 3px; 212 | margin: 0 0.5em 0.5em 0; 213 | padding: 0.5em 1em; 214 | } 215 | #shoutbox-options label input { 216 | margin: 0 .5em 0 0; 217 | } 218 | #shoutbox-options .bg-black { 219 | background: #1b1d1e; 220 | } 221 | #shoutbox-options .bg-blue { 222 | background: blue; 223 | } 224 | #shoutbox-options .bg-green { 225 | background: green; 226 | } 227 | #shoutbox-options .bg-orange { 228 | background: #ff8040; 229 | } 230 | #shoutbox-options .bg-red { 231 | background: red; 232 | } 233 | 234 | input { 235 | height: 3em; 236 | border: 1px solid #979ea1; 237 | border-radius: 3px; 238 | margin: 0 0 1em; 239 | padding: 0 0.5em; 240 | } 241 | 242 | input[type=radio] { 243 | height: 1.3em; 244 | margin: 0 .5em 0 0; 245 | } 246 | 247 | .button { 248 | background: #979ea1; 249 | border: 0; 250 | color: white; 251 | margin: 0; 252 | } 253 | 254 | .button:active { 255 | background: #7c8589; 256 | color: #cccccc; 257 | -webkit-box-shadow: #4b5154 0px -3px 0px inset; 258 | -moz-box-shadow: #4b5154 0px -3px 0px inset; 259 | box-shadow: #4b5154 0px -3px 0px inset; 260 | } 261 | 262 | .card { 263 | background: white; 264 | border-radius: 3px; 265 | -webkit-box-shadow: #979ea1 0px 3px 0px; 266 | -moz-box-shadow: #979ea1 0px 3px 0px; 267 | box-shadow: #979ea1 0px 3px 0px; 268 | margin: 0 0 1em; 269 | padding: 1em; 270 | } 271 | 272 | .container { 273 | height: 100%; 274 | padding: 1em; 275 | width: 100%; 276 | } 277 | 278 | .list table { 279 | width: 100%; 280 | } 281 | .list table thead { 282 | text-align: left; 283 | } 284 | .list table tbody tr { 285 | height: 2em; 286 | vertical-align: middle; 287 | } 288 | .list table tbody tr:hover { 289 | background: #e7e9ea; 290 | } 291 | .list table .m, .list table .s, .list table .t { 292 | display: none; 293 | } 294 | 295 | @media screen and (min-width: 801px) { 296 | #logo { 297 | margin: 0 2em 0 0; 298 | } 299 | 300 | #menu-icon { 301 | display: none; 302 | } 303 | 304 | #top-nav { 305 | clear: none; 306 | display: table-cell; 307 | padding: 0; 308 | vertical-align: middle; 309 | } 310 | #top-nav ul li { 311 | float: left; 312 | } 313 | #top-nav ul li a { 314 | margin: 0 1em 0 0; 315 | padding: 0; 316 | } 317 | 318 | #sidebar { 319 | float: right; 320 | width: 40%; 321 | } 322 | 323 | #main { 324 | float: left; 325 | padding: 0 1em 0 0; 326 | width: 60%; 327 | } 328 | 329 | #shoutbox-input .nickname { 330 | float: left; 331 | margin: 0 1em 0 0; 332 | width: 20%; 333 | } 334 | #shoutbox-input .message { 335 | float: left; 336 | margin: 0 1em 0 0; 337 | width: 60%; 338 | } 339 | #shoutbox-input .button { 340 | float: right; 341 | margin: 0; 342 | width: 15%; 343 | } 344 | 345 | .to-top { 346 | display: none; 347 | } 348 | 349 | .container { 350 | margin: 0 auto; 351 | max-width: 1280px; 352 | width: 90%; 353 | } 354 | 355 | .list table .m, 356 | .list table .s, 357 | .list table .t { 358 | display: table-cell; 359 | } 360 | } 361 | 362 | /* 363 | Progress bar used from the Bootstrap Library: 364 | https://github.com/twbs/bootstrap 365 | 366 | Licensed under the MIT license. 367 | */ 368 | 369 | .progress { 370 | height: 20px; 371 | margin-bottom: 20px; 372 | overflow: hidden; 373 | background-color: #F5F5F5; 374 | border-radius: 4px; 375 | box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1) inset; 376 | } 377 | 378 | .progress-bar { 379 | float: left; 380 | width: 0px; 381 | font-size: 12px; 382 | line-height: 20px; 383 | color: #FFF; 384 | text-align: center; 385 | background-color: #337AB7; 386 | box-shadow: 0px -1px 0px rgba(0, 0, 0, 0.15) inset; 387 | transition: width 0.6s ease 0s; 388 | } 389 | -------------------------------------------------------------------------------- /piratebox/piratebox/www_content/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PirateBox-Dev/PirateBoxScripts_Webserver/25621d780cc27df4ca5b647a303332709c3aa2ab/piratebox/piratebox/www_content/favicon.ico -------------------------------------------------------------------------------- /piratebox/piratebox/www_content/img/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PirateBox-Dev/PirateBoxScripts_Webserver/25621d780cc27df4ca5b647a303332709c3aa2ab/piratebox/piratebox/www_content/img/menu.png -------------------------------------------------------------------------------- /piratebox/piratebox/www_content/img/piratebox-logo-horizontal-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PirateBox-Dev/PirateBoxScripts_Webserver/25621d780cc27df4ca5b647a303332709c3aa2ab/piratebox/piratebox/www_content/img/piratebox-logo-horizontal-white.png -------------------------------------------------------------------------------- /piratebox/piratebox/www_content/img/piratebox-logo-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PirateBox-Dev/PirateBoxScripts_Webserver/25621d780cc27df4ca5b647a303332709c3aa2ab/piratebox/piratebox/www_content/img/piratebox-logo-small.png -------------------------------------------------------------------------------- /piratebox/piratebox/www_content/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PirateBox - Share Freely! 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 34 | 35 |
36 |
37 |
38 |
39 |

Welcome

40 |

Now, first of all, there is nothing illegal or scary going on here. This is a social place where you can chat and share files with people around you, anonymously! This is an off-line network, specially designed and developed for file-sharing and chat services. Staying off the grid is a precaution to maintain your full anonymity. Please have fun, chat with people, and feel free to share any files you may like.

41 | 42 |
43 |
44 | 64 | 65 |
66 |
67 |

Chat

68 |
69 |
70 |
71 | 72 | 73 | 74 |
75 |
76 |

Text Color:

77 | 78 | 79 | 80 | 81 | 82 |
83 | 84 | 91 |
92 |
93 |
94 |
95 |
96 | 97 |
98 |
99 |
100 |

Back to top

101 |

About PirateBox

102 |

Inspired by pirate radio and the free culture movement, PirateBox is a self-contained mobile collaboration and file sharing device. PirateBox utilizes Free, Libre and Open Source software (FLOSS) to create mobile wireless file sharing networks where users can anonymously share images, video, audio, documents, and other digital content.

103 |

PirateBox is designed to be safe and secure. No logins are required and no user data is logged. The system is purposely not connected to the Internet in order to prevent tracking and preserve user privacy.

104 | PirateBox is licensed under GPLv3. 105 |
106 |
107 |
108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /piratebox/piratebox/www_content/js/scripts.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | $.get('/station_cnt.txt', function(data) { 3 | $('div#station').html(data); 4 | }); 5 | 6 | $('div#shoutbox').ajaxError(function() { 7 | $(this).text( "Triggered ajaxError handler on shoutbox" ); 8 | }); 9 | 10 | $("#sb_form").submit(function(event) { 11 | /* stop form from submitting normally */ 12 | event.preventDefault(); 13 | post_shoutbox(); 14 | }); 15 | 16 | $("#du_form").submit(function(event) { 17 | /* stop form from submitting normally */ 18 | event.preventDefault(); 19 | post_diskusage(); 20 | }); 21 | 22 | display_diskusage(); 23 | display_shoutbox(); 24 | 25 | // Add Tooltips 26 | if ( $('#du_form_button').lenght ) { 27 | $('#du_form_button').tooltip(); 28 | } 29 | 30 | // Spin menu icon and toggle nav 31 | $('#menu-icon').click(function() { 32 | $(this).toggleClass('rotate'); 33 | $('#top-nav').slideToggle(); 34 | }); 35 | 36 | // Closes the mobile nav 37 | $('#top-nav a').click(function() { 38 | if ($('#top-nav').is(':visible') 39 | && $('#menu-icon').is(':visible')) { 40 | $('#top-nav').slideUp(); 41 | $('#menu-icon').toggleClass('rotate'); 42 | } 43 | }); 44 | 45 | // Hides the welcome 46 | $('#thanks').click(function() { 47 | $('#welcome').slideUp(); 48 | }); 49 | 50 | // Detects window size 51 | $(window).resize(function() { 52 | if ($('#menu-icon').is(':visible')) { 53 | $('#top-nav').hide(); 54 | } else { 55 | $('#top-nav').show(); 56 | } 57 | }); 58 | 59 | post_diskusage(); 60 | 61 | // smooth scrolling for internal links 62 | function filterPath(string) { 63 | return string 64 | .replace(/^\//,'') 65 | .replace(/(index|default).[a-zA-Z]{3,4}$/,'') 66 | .replace(/\/$/,''); 67 | } 68 | var locationPath = filterPath(location.pathname); 69 | var scrollElem = scrollableElement('html', 'body'); 70 | 71 | $('a[href*=\\#]').each(function() { 72 | var thisPath = filterPath(this.pathname) || locationPath; 73 | if ( locationPath == thisPath 74 | && (location.hostname == this.hostname || !this.hostname) 75 | && this.hash.replace(/#/,'') ) { 76 | var $target = $(this.hash), target = this.hash; 77 | if (target) { 78 | var targetOffset = $target.offset().top; 79 | $(this).click(function(event) { 80 | event.preventDefault(); 81 | $(scrollElem).animate({scrollTop: targetOffset}, 400, function() { 82 | location.hash = target; 83 | }); 84 | }); 85 | } 86 | } 87 | }); 88 | 89 | // use the first element that is "scrollable" 90 | function scrollableElement(els) { 91 | for (var i = 0, argLength = arguments.length; i 0) { 95 | return el; 96 | } else { 97 | $scrollElement.scrollTop(1); 98 | var isScrollable = $scrollElement.scrollTop()> 0; 99 | $scrollElement.scrollTop(0); 100 | if (isScrollable) { 101 | return el; 102 | } 103 | } 104 | } 105 | return []; 106 | } 107 | }); 108 | 109 | function refresh_shoutbox () { 110 | $.get('/chat_content.html', function(data) { 111 | $('div#shoutbox').html(data); 112 | }); 113 | } 114 | 115 | function refresh_time_sb () { 116 | // Refresh rate in milli seconds 117 | mytime=setTimeout('display_shoutbox()', 10000); 118 | } 119 | 120 | function post_shoutbox () { 121 | $("#send-button").prop('value', 'Sending...'); 122 | $("#send-button").prop('disabled', true); 123 | 124 | $.post("/cgi-bin/psowrte.py" , $("#sb_form").serialize()) 125 | .success(function() { 126 | refresh_shoutbox(); 127 | $("#send-button").prop('value', 'Send') 128 | $("#send-button").prop('disabled', false); 129 | }); 130 | $('#shoutbox-input .message').val(''); 131 | } 132 | 133 | function display_shoutbox() { 134 | refresh_shoutbox(); 135 | refresh_time_sb(); 136 | } 137 | 138 | function refresh_diskusage() { 139 | $.get('/diskusage.html', function(data) { 140 | $('div#diskusage').html(data); 141 | }); 142 | } 143 | 144 | function refresh_time_du () { 145 | // Refresh rate in milli seconds 146 | mytimedu=setTimeout('display_diskusage()', 10000); 147 | } 148 | 149 | function post_diskusage() { 150 | $("#du_form_button").prop('value', 'Refreshing...'); 151 | $("#du_form_button").prop('disabled', true); 152 | 153 | $.post("/cgi-bin/diskwrite.py") 154 | .success(function() { 155 | refresh_diskusage(); 156 | $("#du_form_button").prop('value', 'Refresh'); 157 | $("#du_form_button").prop('disabled', false); 158 | }); 159 | $('#diskusage-input .message').val(''); 160 | 161 | 162 | } 163 | 164 | function display_diskusage() { 165 | refresh_diskusage(); 166 | refresh_time_du(); 167 | } 168 | 169 | function fnGetDomain(url) { 170 | return url.match(/:\/\/(.[^/]+)/)[1]; 171 | } 172 | -------------------------------------------------------------------------------- /piratebox/piratebox/www_content/locales/data.de.properties: -------------------------------------------------------------------------------- 1 | # German strings 2 | # vim: ft=jproperties 3 | 4 | link = link 5 | navbarHome = Home 6 | navbarForum = Forum 7 | navbarFiles = Dateien 8 | navbarAbout.innerHTML = Über 9 | logoIMG.alt = PirateBox 10 | logoIMG.title = PirateBox - Share Freely 11 | 12 | welcomeWelcome = Willkommen 13 | welcomeDescription.innerHTML = Das Wichtigste vorweg: Hier geht nichts Illegales oder Unheimliches vor. Dies ist ein sozialer Platz, wo jeder chatten und Dateien austauschen kann und zwar anonym! Dies ist ein Offline-Netzwerk, speziell zum Filesharing und Chatten entwickelt. Vom Netz getrennt zu sein ist die Voraussetzung für volle Anonymität. Hab Spaß, chatte mit Menschen und teile Dateien, die du magst. 14 | welcomeThanksButton.value = Alles klar! 15 | sidebarUpload = Upload -> 16 | sidebarIframeNotSupported = Dein Browser unterstützt keine Iframes. Wenn du etwas hochladen möchtest, hier entlang: 17 | sidebarBrowseFiles.innerHTML = Dateien durchstöbern -> 18 | 19 | diskUsage = Belegter Speicherplatz 20 | refreshButton.value = Aktualisieren 21 | refreshButton.title = Der belegte Speicherplatz kann nur alle 5 Minuten neu abgefragt werden. 22 | 23 | mainChatChat = Chat 24 | mainChatSend.value = Senden 25 | mainChatName.placeholder = Alias 26 | mainChatName.value = Anonymous 27 | mainChatMessage.placeholder = Nachricht... 28 | mainChatTextColor = Textfarbe: 29 | mainShoutboxDefault = Standard 30 | mainShoutboxBlue = Blau 31 | mainShoutboxGreen = Gruen 32 | mainShoutboxOrange = Orange 33 | mainShoutboxRed = Rot 34 | 35 | footerBackToTop = Zum Seitenanfang 36 | footerAbout.innerHTML = Über 37 | footerInspired.innerHTML = Inspiriert durch Piratensender und der Freien-Kultur-Bewegung, ist die PirateBox ein in sich abgeschlossenes Gerät zur mobilen Zusammenarbeit und zum Filesharing. Die PirateBox nutzt freie, offene Software (FLOSS), um mobile, drahtlose Filesharing-Netzwerke aufzubauen, wo Nutzer Bilder, Video-, Audio-Dateien, Dokumente und andere digitale Inhalte teilen können. 38 | footerFilesTopSafety.innerHTML = Die PirateBox wurde designt, um sicher und ungefährlich zu sein. Es sind keine Logins/Registrierungen erforderlich und keine Benutzer-Daten werden geloggt. Um Tracking zu vermeiden und Datenschutz sicherzustellen, ist das System absichtlich nicht mit dem Internet verbunden. 39 | footerLicenceMain = PirateBox ist lizensiert unter GPLv3. 40 | -------------------------------------------------------------------------------- /piratebox/piratebox/www_content/locales/data.en.properties: -------------------------------------------------------------------------------- 1 | # English strings 2 | # vim: ft=jproperties 3 | 4 | link = link 5 | navbarHome = Home 6 | navbarForum = Forum 7 | navbarFiles = Files 8 | navbarAbout = About 9 | logoIMG.alt = PirateBox 10 | logoIMG.title = PirateBox - Share Freely 11 | 12 | welcomeWelcome = Welcome 13 | welcomeDescription.innerHTML = Now, first of all, there is nothing illegal or scary going on here. This is a social place where you can chat and share files with people around you, anonymously! This is an off-line network, specially designed and developed for file-sharing and chat services. Staying off the grid is a precaution to maintain your full anonymity. Please have fun, chat with people, and feel free to share any files you may like. 14 | welcomeThanksButton.value = Thanks 15 | sidebarUpload = Go to Upload -> 16 | sidebarIframeNotSupported = Your browser does not support iframes.. If you want to upload something, follow this 17 | sidebarBrowseFiles = Browse Files -> 18 | 19 | diskUsage = Disk Usage 20 | refreshButton.value = Refresh 21 | refreshButton.title = Disk usage can only be refreshed every 5 minutes 22 | 23 | mainChatChat = Chat 24 | mainChatSend.value = Send 25 | mainChatName.placeholder = Alias 26 | mainChatName.value = Anonymous 27 | mainChatMessage.placeholder = Message... 28 | mainChatTextColor = Text Color: 29 | mainShoutboxDefault = Default 30 | mainShoutboxBlue = Blue 31 | mainShoutboxGreen = Green 32 | mainShoutboxOrange = Orange 33 | mainShoutboxRed = Red 34 | 35 | footerBackToTop = Back to top 36 | footerAbout = About 37 | footerInspired = Inspired by pirate radio and the free culture movement, PirateBox is a self-contained mobile collaboration and file sharing device. PirateBox utilizes Free, Libre and Open Source software (FLOSS) to create mobile wireless file sharing networks where users can anonymously share images, video, audio, documents, and other digital content. 38 | footerFilesTopSafety = PirateBox is designed to be safe and secure. No logins are required and no user data is logged. The system is purposely not connected to the Internet in order to prevent tracking and preserve user privacy. 39 | footerLicenceMain = PirateBox is licensed under GPLv3. 40 | -------------------------------------------------------------------------------- /piratebox/piratebox/www_content/locales/data.es.properties: -------------------------------------------------------------------------------- 1 | # English strings 2 | # vim: ft=jproperties 3 | 4 | link = enlace 5 | navbarHome = Inicio 6 | navbarForum = Foro 7 | navbarFiles = Ficheros 8 | navbarAbout = Acerca de 9 | logoIMG.alt = PirateBox 10 | logoIMG.title = PirateBox - Compartir Libremente 11 | 12 | welcomeWelcome = Bienvenida 13 | welcomeDescription.innerHTML = Ahora, lo primero de todo, no hay nada ilegal o raro entrando aqui. Este es un sitio social donde puedes charlar y compartir ficheros con gente de alrededor tuyo, anonimamente! Esta es una red desconectada, especialmente diseñada y desarrollada para servicios de comparticion de ficheros y charlas. Estar desconectado es una precaucion para mantener un completo anonimato. Por favor, pasalo bien, charla con gente, y siente libre de compartir los ficheros que tu quieras. 14 | welcomeThanksButton.value = Gracias 15 | sidebarUpload = Subir ficheros -> 16 | sidebarIframeNotSupported = Tu navegador no soporta iframes.. Si quieres subir algo, sigue esto 17 | sidebarBrowseFiles = Ver Ficheros -> 18 | 19 | diskUsage = Uso de disco 20 | refreshButton.value = Actualizar 21 | refreshButton.title = El uso de disco solo puede ser actualizado cada 5 minutos 22 | 23 | mainChatChat = Charlar 24 | mainChatSend.value = Enviar 25 | mainChatName.placeholder = Alias 26 | mainChatName.value = Anonimo 27 | mainChatMessage.placeholder = Mensaje... 28 | mainChatTextColor = Color de texto: 29 | mainShoutboxDefault = Por defecto 30 | mainShoutboxBlue = Azul 31 | mainShoutboxGreen = Verde 32 | mainShoutboxOrange = Naranja 33 | mainShoutboxRed = Rojo 34 | 35 | footerBackToTop = Ir a arriba 36 | footerAbout = Acerca de 37 | footerInspired = Inspirada en las radios piratas y en el movimiento de cultura libre, PirateBox es un dispositivo movil auto-contenido para la colaboracion y comparticion de ficheros. PirateBox utiliza software libre, gratuito y de codigo abierto (FLOSS) para redes wireless moviles de comparticion de ficheros donde los usuarios pueden compartir anonimamente imagenes, videos, audio, documentos, y otros contenidos digitales. 38 | footerFilesTopSafety = PirateBox esta diseñado para ser estable y seguro. No se requiere registro y ningun dato de usuario es registrado. El sistema no esta conectado a internet a proposito para prevenir el seguimiento y preservar la privacidad del usuario. 39 | footerLicenceMain = PirateBox esta licenciado bajo GPLv3. 40 | -------------------------------------------------------------------------------- /piratebox/piratebox/www_content/locales/data.eu.properties: -------------------------------------------------------------------------------- 1 | # Euskara strings 2 | # by Astur 3 | # vim: ft=jproperties 4 | 5 | link = lotura 6 | navbarHome = Hasiera 7 | navbarForum = Foroa 8 | navbarFiles = Fitxategiak 9 | navbarAbout = Honi buruz 10 | logoIMG.alt = PirateBox 11 | logoIMG.title = PirateBox - Aske Partekatu 12 | 13 | welcomeWelcome = Ongi Etorri 14 | welcomeDescription.innerHTML = Orain, lehenik etra behin, ez dago ezer arrarorik edo legez kanpo hona sartuz. Hau zure inguruko jendearekin hitz egiteko eta fitxategiak partekatzeko gune sozial bat da. Hau konexiorik gabeko sarea da, bereziki fitxategiak partekatzeko eta hitz egiteko diseinaturik. Konexiorik gabe egotea erabateko anonimotasunari eusteko segurtasun neurria da. Mesedez, ondo pasa, jendearekin hitz egin eta aske sentitu nahi dituzun fitxategiak partekatzeko. 15 | welcomeThanksButton.value = Eskerrik asko 16 | sidebarUpload = Fitxategiak igo -> 17 | sidebarIframeNotSupported = Zure nabigatzaileak ez du iframerik onartzen.. Zerbait igotzeko, jarraitu honi 18 | sidebarBrowseFiles = Fitxategiak ikusi -> 19 | 20 | diskUsage = Diskoaren erabilera 21 | refreshButton.value = Eguneratu 22 | refreshButton.title = Diskoaren erabilera 5 minutuan behin baino ezin da eguneratu 23 | 24 | mainChatChat = Hitz egin 25 | mainChatSend.value = Bidali 26 | mainChatName.placeholder = Ezizena 27 | mainChatName.value = Anonimoa 28 | mainChatMessage.placeholder = Mezua.. 29 | mainChatTextColor = Testuaren kolorea: 30 | mainShoutboxDefault = Lehenetsita 31 | mainShoutboxBlue = Urdina 32 | mainShoutboxGreen = Berdea 33 | mainShoutboxOrange = Laranja 34 | mainShoutboxRed = Gorria 35 | 36 | footerBackToTop = Gora itzuli 37 | footerAbout = Honi buruz 38 | footerInspired = Irrati piratetan eta kultura askearen mugimenduan inspiraturik, PirateBox fitxategiak partekatzeko eta auzolanerako tresna bateratu eta eramangarria da. PirateBox-ek fitxategiak partekatzeko wireless sare eramangarrietarako software askea, doakoa eta kode irekikoa (FLOSS) erabiltzen du, non erabiltzaileek anononimoki irudiak, bideoak, audioa, dokumentuak eta bestelako eduki digitalak parteka ditzaketen. 39 | footerFilesTopSafety = PirateBox egonkorra eta segurua izateko diseinaturik dago. Ez da erregistrorik behar, eta ez da erabiltzaileen daturik gordetzen. Sistema nahita deskonektaturik dago internetetik jazarpena saihesteko eta erabiltzailearen pribatutasuna babesteko. 40 | footerLicenceMain = PirateBox GPLv3 lizentziapean dago 41 | -------------------------------------------------------------------------------- /piratebox/piratebox/www_content/locales/data.fr.properties: -------------------------------------------------------------------------------- 1 | # French strings 2 | # vim: ft=jproperties 3 | 4 | link = lien 5 | navbarHome = Accueil 6 | navbarForum = Forum 7 | navbarFiles = Fichiers 8 | navbarAbout = À propos 9 | logoIMG.alt = PirateBox 10 | logoIMG.title = PirateBox - Partagez librement 11 | 12 | welcomeWelcome = Bienvenue 13 | welcomeDescription.innerHTML = Tout d'abord, il ne se passe rien d'illégal ou d'effrayant ici. C'est un lieu social où vous pouvez discuter et partager anonymement des fichiers avec les personnes qui vous cotoient! C'est un réseau hors ligne, spécialement conçu et développé pour le partage de fichiers et la discussion. Rester hors du web est une précaution qui permet de garantir votre total anonymat. Amusez vous, discutez, et surtout partagez les fichiers que vous aimez. 14 | welcomeThanksButton.value = Merci 15 | sidebarUpload = Partagez des fichiers -> 16 | sidebarIframeNotSupported = Votre navigateur ne supporte pas les iframes. Si vous souhaitez uploader quelque chose, suivez ce 17 | sidebarBrowseFiles = Parcourir les fichiers -> 18 | 19 | diskUsage = Espace de stockage 20 | refreshButton.value = Rafraichir 21 | refreshButton.title = Le taux d'utilisation du disque ne peut être rafraîchi que toutes les 5 minutes 22 | 23 | mainChatChat = Chat 24 | mainChatSend.value = Envoyer 25 | mainChatName.placeholder = Pseudo 26 | mainChatName.value = Anonyme 27 | mainChatMessage.placeholder = Message... 28 | mainChatTextColor = Couleur du texte: 29 | mainShoutboxDefault = Défaut 30 | mainShoutboxBlue = Bleu 31 | mainShoutboxGreen = Vert 32 | mainShoutboxOrange = Orange 33 | mainShoutboxRed = Rouge 34 | 35 | footerBackToTop = Vers le haut 36 | footerAbout = À propos 37 | footerInspired = Inspiré par les radios pirate et le mouvement de la culture libre, PirateBox est un dispositif mobile autonome de collaboration et de partage de fichiers. PirateBox utilise des logiciels libres pour créer des réseaux mobiles sans fils de partage de fichiers dont les utilisateurs peuvent partager de manière anonyme des images, des vidéos, de l'audio, des documents ou tout autre contenu numérique. 38 | footerFilesTopSafety = PirateBox est conçue pour être sûre et sécurisée. Aucun compte utilisateur n'est requis et aucune donnée utilisateur n'est sauvegardée. Le système n'est volontairement pas connecté à Internet afin de prévenir toute tentative de suivi et de préserver la vie privée de ses utilisateurs. 39 | footerLicenceMain = PirateBox est distribuée sous licence GPLv3. 40 | -------------------------------------------------------------------------------- /piratebox/piratebox/www_content/locales/data.pt-br.properties: -------------------------------------------------------------------------------- 1 | # Portuguese (Brazilian) strings 2 | # vim: ft=jproperties 3 | 4 | link = link 5 | 6 | #Some words like "link", "chat" and "upload" I chose to keep in English, because they are kind of part of the Brazilian vocabulary and more appropriate in this case ... -- 'Akira 7 | 8 | navbarHome = Página Inicial 9 | navbarForum = Fórum 10 | navbarFiles = Arquivos 11 | navbarAbout = Sobre 12 | logoIMG.alt = PirateBox 13 | logoIMG.title = PirateBox - Compartilhe Livremente 14 | 15 | welcomeWelcome = Bem-vindx 16 | 17 | # In portuguese, we have a lot of words that are flexible to gender. In the majority of the cases, these words are used in the masculine form to refer to all the genders. This pratice makes the language machist, while excluding thos who do not feel represented by this writing of the language. So, some people started to write those words with an "x" at the "end" (instead of the vowel "o" for masculine and "a" for feminine) in the hope to make this people more comfortable and included =D -- 'Akira 18 | 19 | welcomeDescription.innerHTML = Primeiramente, não há nada ilegal ou assustador acontecendo aqui. Este é um lugar social onde você pode conversar e compartilhar arquivos com pessoas do seu entorno de forma anônima! Esta e uma rede off-line, especialmente desenhada e desenvolvida para o compartilhamento de arquivos e serviços de chat. Estar fora do grid computacional é uma precaução para manter sua total anonimidade. Por favor, divirta-se, converse com pessoas e sinta-se livre para compartilhar os arquivos que quiser. 20 | 21 | welcomeThanksButton.value = Obrigadx 22 | sidebarUpload = Ir para o Upload -> 23 | sidebarIframeNotSupported = Seu navegador não suporta o iframes.. Caso você queira fazer o upload de algo siga, siga isto 24 | sidebarBrowseFiles = Navegue pelos Arquivos -> 25 | 26 | diskUsage = Uso do Disco 27 | refreshButton.value = Recarregar 28 | refreshButton.title = O uso do disco pode ser recarregado apenas a cada 5 minutos 29 | 30 | mainChatChat = Chat 31 | mainChatSend.value = Enviar 32 | mainChatName.placeholder = Pseudônimo 33 | mainChatName.value = Anônimx 34 | mainChatMessage.placeholder = Mensagem... 35 | mainChatTextColor = Cor do Texto: 36 | mainShoutboxDefault = Padrão 37 | mainShoutboxBlue = Azul 38 | mainShoutboxGreen = Verde 39 | mainShoutboxOrange = Laranja 40 | mainShoutboxRed = Vermelho 41 | 42 | footerBackToTop = Voltar ao topo 43 | footerAbout = Sobre 44 | footerInspired = Inspirado pelo rádio pirata e pelo movimento da cultura livre, PirateBox é um dispositivo móvel de colaboração e compartilhamento de arquivos auto-contido. PirateBox utiliza software Livre e de Código Aberto (FLOSS, da sigla em inglês) para criar redes moveis de compartilhamento de arquivos em que usuárixs podem compartilhar imagens, vídeo, áudio, documentos e outros conteúdos digitais, de forma anônima. 45 | 46 | footerFilesTopSafety = PirateBox é desenhado com segurança em mente. Nenhum login é requerido e nenhum dado sobre x usuárix é gravado. O sistema é propositalmente nõo conectado à Internet, de forma a prevenir o rastreamento e preservar a privacidade dxs usuárixs. 47 | #In portuguese both words "safe" and "secure" could be translated as "segurança" (more precisely "seguro") in this context. So I had to change the sentence slightly for something similar (in a gross translation from portuguese to english) to "PirateBox is designed with safety and security in mind". 48 | footerLicenceMain = PirateBox é licenciado pela GPLv3. 49 | -------------------------------------------------------------------------------- /piratebox/piratebox/www_content/locales/data.ru.properties: -------------------------------------------------------------------------------- 1 | # English strings 2 | # vim: ft=jproperties 3 | 4 | link = ссылка 5 | navbarHome = Главная 6 | navbarForum = Форум 7 | navbarFiles = Файлы 8 | navbarAbout = О Проекте 9 | logoIMG.alt = PirateBox 10 | logoIMG.title = PirateBox - Распространяй Свободно 11 | 12 | welcomeWelcome = Добро Пожаловать 13 | welcomeDescription.innerHTML = Во-первых, здесь не происходит ничего незаконного или страшного. Это общественная площадка, где вы можете болтать и делиться файлами с людьми вокруг вас анонимно! Это оффлайн сеть, специально спроектированная и разработанная для обмена файлами и сервисов для общения. Отсутствие подключения к Интернету обеспечивает вашу полную анонимность. Наслаждайтесь, общайтесь с другими пользователями и свободно делитесь своими файлами. 14 | welcomeThanksButton.value = Спасибо 15 | sidebarUpload = Перейти К Загрузке -> 16 | sidebarIframeNotSupported = Ваш браузер не поддерживает IFrame.. Если вы хотите загрузить что-нибудь, пройдите сюда 17 | sidebarBrowseFiles = Просмотр Файлов -> 18 | 19 | diskUsage = Использование Диска 20 | refreshButton.value = Обновить 21 | refreshButton.title = Обновлять данные об использовании диска можно только раз в 5 минут 22 | 23 | mainChatChat = Чат 24 | mainChatSend.value = Отправить 25 | mainChatName.placeholder = Псевдоним 26 | mainChatName.value = Аноним 27 | mainChatMessage.placeholder = Сообщение... 28 | mainChatTextColor = Цвет Текста: 29 | mainShoutboxDefault = По-умолчанию 30 | mainShoutboxBlue = Синий 31 | mainShoutboxGreen = Зелёный 32 | mainShoutboxOrange = Оранжевый 33 | mainShoutboxRed = Красный 34 | 35 | footerBackToTop = Вверх 36 | footerAbout = О проекте 37 | footerInspired = PirateBox это самодостаточное мобильное устройство для общения и файлообмена, созданное под вдохновлением от пиратских радиостанций и движения за свободную культуру. В PirateBox используется свободное программное обеспечение с открытым исходным кодом для создания мобильных беспроводных сетей обмена файлами, в которых пользователи могут анонимно обмениваться картинками, видео, музыкой, документами и другим цифровым контентом. 38 | footerFilesTopSafety = PirateBox спроектирован для полной безопасности. Тут не требуют регистрироваться и не сохраняются никакие данные о пользователях. Система специально отключена от Интернета, чтобы предотвратить слежку и сохранить приватность пользователя. 39 | footerLicenceMain = PirateBox распространяется под лицензией GPLv3. 40 | -------------------------------------------------------------------------------- /piratebox/piratebox/www_content/locales/locales.ini: -------------------------------------------------------------------------------- 1 | [de] 2 | @import url(data.de.properties) 3 | 4 | [en] 5 | @import url(data.en.properties) 6 | 7 | [fr] 8 | @import url(data.fr.properties) 9 | 10 | [pt-br] 11 | @import url(data.pt-br.properties) 12 | 13 | [es] 14 | @import url(data.es.properties) 15 | 16 | [eu] 17 | @import url(data.eu.properties) 18 | 19 | [ru] 20 | @import url(data.ru.properties) 21 | -------------------------------------------------------------------------------- /piratebox/readme.txt: -------------------------------------------------------------------------------- 1 | ## Piratebox for laptop (eeePc) script collection WITH LIGHTTPD 2 | ## created by Matthias Strubel (matthias.strubel@aod-rpg.de) 2014-01-17 3 | ## licenced by GPL-3 ;; please feel for improvements or feedback :) 4 | ## 5 | -------------------------------------------------------------------------------- /rpi.motd-template.txt: -------------------------------------------------------------------------------- 1 | ____________________.__ __ __________ 2 | \______ \______ \__|___________ _/ |_ ____\______ \ _______ ___ 3 | | _/| ___/ \_ __ \__ \\ __\/ __ \| | _// _ \ \/ / 4 | | | \| | | || | \// __ \| | \ ___/| | ( <_> > < 5 | |____|_ /|____| |__||__| (____ /__| \___ >______ /\____/__/\_ \ 6 | \/ \/ \/ \/ \/ 7 | 8 | Website: http://piratebox.cc PirateBox Version: ##version## 9 | Forum: http://forum.piratebox.cc Build date: 00-00-0000 10 | IRC: #piratebox irc.freenode.net Be open -- Share freely! 11 | 12 | First Steps After Flashing 13 | 1. Change password of alarm user 14 | > passwd 15 | 2. Change password of root user 16 | > sudo passwd root 17 | 3. Enable Fake-Timeservice 18 | 3.1 Set date and time 19 | # Disable network time sync 20 | > sudo timedatectl set-ntp false 21 | # Set time to "Mon May 23 17:42:00" (Format: CCYYMMDD hhmm) 22 | > sudo date -s "20170523 1742" 23 | > cd /opt/piratebox && sudo ./bin/timesave.sh ./conf/piratebox.conf install 24 | 3.2 Enable on startup 25 | > sudo systemctl enable timesave 26 | 4. Enable the Kareha Image and Discussion Board 27 | > sudo /opt/piratebox/bin/board-autoconf.sh 28 | 5. Enable USB thumb drive share OR extend SDCard 29 | USB: > sudo /opt/piratebox/rpi/bin/usb_share.sh 30 | SDCard: > sudo /opt/piratebox/rpi/bin/sdcard_share.sh 31 | 6. Enable UPnP Media Server 32 | > sudo cp /etc/minidlna.conf /etc/minidlna.conf.bkp 33 | > sudo cp /opt/piratebox/src/linux.example.minidlna.conf /etc/minidlna.conf 34 | > sudo systemctl start minidlna 35 | > sudo systemctl enable minidlna 36 | 7. Enable RealTimeClock timekeeping (needs DS3231 or 1307 RTC module!) 37 | > sudo systemctl enable rpi_hwclock 38 | --------------------------------------------------------------------------------