Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate releases on Github and PYPI #956

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python:
- "2.7"

install:
- pip install pylint tox scapy
- pip install pylint tox scapy twine
- pip install tornado==4.5.3
- python setup.py install

Expand Down Expand Up @@ -47,3 +47,10 @@ addons:
packages:
- hostapd
- dnsmasq

deploy:
provider: script
skip_cleanup: true
script: bash deploy.sh
on:
branch: master
75 changes: 0 additions & 75 deletions CHANGELOG

This file was deleted.

78 changes: 78 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
v1.4 (2018-01-12)
=====

New Features:
-----
* <address></address> dissociation frame to DEAUTH attack 993228c917a2046819cc673b2e35789e4a36f77e
* support wireless card for internet option interface00c1b64ae03a475dbf283ac455bfbb627fd729aa
* kill interfering processes on startup 9127a91f06d245bfbe22cd9fc58ec398aba860fa
* use curses everywhere cfa632aee59624b5caf2703297802f01fe4d5a89
* add captured passphrase validation 3d255e73e44c627380380c6685aa9e82c9b75f52
* add option to deauthenticate based on ESSID 225cd72b4b6e0f0088b592be2a63c2be5f932d29
* add --logging option db4a3f126fbaef3434f9c369f1b708ee34693b58
* add target channel monitoring 2940a94a790121dc0735c1c0990ca430d4e829d4
* add known beacons attack affbc3d911decd6db32813da53025fd28c24bc0a
* add WPS PBC phishing attack 2b1bae7566f113438b78e7972e2249bf61357353
* support only one physical interface e9e7690ad0a1e3f04a2d5ecc721d9e5a3781659c

Bug Fixes:
-----
* RSSI output 4efea79277c0c288d2df6402232556a9d8c35f9a

v1.3 (2017-04-15)
=====

New Features:
-----
* add --quitonsuccess option 557086e86a5d38c71078ad017a63e88032e02d67
* add Lure10 attack 5e77abb5d0893835c629c2d8a53719eba65a8289
* add --internetinterface option de63c2394cf5a4a28ee174663dfaf2a4c9867dc4
* support iOS and Android in network manager template 36ed91960533d64d0c712ce334d5e7a345a538fd
* new target AP selection phase cb7ff03b7e06716693e99348ce86483dc41e73af

Bug Fixes:
-----
* bugs in tornado d19337ad3c0d39a9dcc11a316e2ce6f0f22fdb16
* Remove DNS leases after the script restarts 7970cc10e6a63f245b4ca4a7d5a974cafe35ffe3

v1.2 (2016-12-04)
=====

New Features:
-----
* add "Wi-Fi Connect" template 41f3220d4de53672c577f7758ae1110ee316059d
* allow multiple POST values 24e52210b2dec7f673c4371ec799083f57fdb6b7
* add interactive scenario selection 9163fd2ebbbb2025850b1fc23c8f6eba5510597a
* add --presharedkey option f764075a7deb6c2b7b049e9a84388adfc3c4f911
* add "Browser Plugin Update" scenario b5e1bd744896f8a14840ad55acfa8614330bc018
* add --essid option bc94f90e578037c8e6f9422b3767f8d2c45abe81
* add --nojamming option 4a160467a04a4ee564b98e6dc1a69a7d4fd4e3a8
* add OAuth template 0c8deaea7d42bf69b9727c6f53407824abe45c55
* detect target vendor based on BSSID 7fc1787150182d8ac3ea2b797585ea46d53689e7
* add template engine support 6c7de9164878df9b14946b6192053442be948e5f

Bug Fixes:
-----
* issues on Ubuntu e8929c8673788e0213cf267dc25ee2de5c9169bd
* issues on Arch Linux da54b7580023ec0577fa654b254483049fe23bf9
* start server after DHCP 4b193b5b897974b72daaa3f2b9a4bbc855659e6d
* bugs on HTTP server f6dcce260d482da62de964fc039788679de333b3

v1.1 (2015-07-01)
=====

New Features:
-----
* add support for Pineapple's DD-WRT 03be17e28c6c4bb5ef468b1c84b5593d317b1d53
* add connection-reset template 32cd212911557905ff10ffaafc5619e125ae0917

Bug Fixes:
-----
* chage shebang deafulting to python2 c3cbca2e68c9942e71a86a205496dc7380ccb4b0
* undefined variable use #7 444eb3d3ae0113e3e22ab8f211b39875b23b3859
* string concatenation error 4da046d28fede6249f49da0da419e655e411417b
* empty password redirect 864dab8986a43416ce9aeec6963e14e33a4b5a6c
* exception when port is unavailable a5a3dd9fc607083bf92bdc450123ec175e74a6db
* message output in case hostapd is notinstalled c2270153ae05e7b94d06efff81d0b1693feb1d94
* PEP8 errors 587fd51004ad5a83fe2294ba4f2a936030d2366d
* prohibit internet interface for other usage
126 changes: 126 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
#!/usr/bin/env bash

set -o errexit
set -o pipefail
#set -o xtrace

main(){
git checkout --quiet master
local current_version
current_version=$(grep -i "version =" setup.py |
cut -d= -f2 | tr -d "\" ")
echo -e "\\u25b7\\u25b7 Current Version = \\e[91m${current_version}\\e[39m"

local new_version
local major
local minor
local patch
major=$(echo "${current_version}" |cut -d"." -f1)
minor=$(echo "${current_version}" |cut -d"." -f2)
patch=$(echo "${current_version}" |cut -d"." -f3)

local logs
logs="$(git log "$(git describe --tags --abbrev=0)"..HEAD)"

if echo "${logs}" | grep -iq "breaking change";then
echo -e "\\e[41mBreaking Change Detected!\\e[49m"
new_version="$((major + 1)).0.0"
elif echo "${logs}" | grep -q "feat:"; then
echo -e "\\e[41mNew Feature Detected!\\e[49m"
new_version="${major}.$((minor + 1)).0"
elif echo "${logs}" | grep -q "fix:"; then
echo -e "\\e[41mNew Fix Detected!\\e[49m"
new_version="${major}.${minor}.$((patch + 1))"
else
echo -e "\\e[41mNo Version Change!\\e[49m"
exit 0
fi

echo -e "\\u25b7\\u25b7 New Version = \\e[92m${new_version}\\e[39m"

echo -e "\\u25b7\\u25b7 Changing Version Numbers"
sed -i "s/$current_version/$new_version/" setup.py
sed -i "s/$current_version/$new_version/" wifiphisher/pywifiphisher.py

echo -e "\\e[93m\\u2744\\e[0m Generating New Changelog"
local name_url="https://frightanic.com/goodies_content/docker-names.php"
local code_name
code_name="$(curl -s "$name_url")"
echo -e "\\u25b7\\u25b7 New Version Code Name Is \\e[42m\\e[30m${code_name}\
\\e[39m\\e[49m"
echo "${new_version} ${code_name} ($(date +"%F"))" >> temp_changelog.md
echo "=====" >> temp_changelog.md
echo >> temp_changelog.md

if echo "${logs}" | grep -iq "breaking change"; then
echo "Breaking Change" >> temp_changelog.md
echo "----" >> temp_changelog.md
echo "${logs}" | grep -i 'breaking change:' | cut -d: -f2 |
sed 's/^ //' >> temp_changelog.md
echo >> temp_changelog.md
fi

local commit_hashes
local message
commit_hashes="$(git rev-list "$(git describe --tags --abbrev=0)"..HEAD \
--no-merges)"

if echo "${logs}" | grep -q "feat:"; then
echo "New Features:" >> temp_changelog.md
echo "-----" >> temp_changelog.md

for hash in $commit_hashes;do
message=$(git log -n 1 --pretty=format:%s "${hash}")
if [[ "${message}" =~ ^feat:.*$ ]];then
echo "* $(echo "${message}" | cut -d: -f2 ) ${hash}" \
>> temp_changelog.md
fi
done
echo >> temp_changelog.md
fi

if echo "${logs}" | grep -q "fix:"; then
echo "Bug Fixes:" >> temp_changelog.md
echo "-----" >> temp_changelog.md
for hash in $commit_hashes;do
message=$(git log -n 1 --pretty=format:%s "${hash}")
if [[ $message =~ ^fix:.*$ ]];then
echo "* $(echo "${message}" | cut -d: -f2 ) ${hash}" \
>> temp_changelog.md
fi
done
echo >> temp_changelog.md
fi

echo -e "\\e[93m\\u2744\\e[0m Uploading to Github"
git config --global user.name "release-bot"
git config --global user.email "release-bot@github.com"
local github_url="https://${GH_TOKEN}@github.com/wifiphisher/\
wifiphisher.git"
git remote add new "${github_url// /}"
git add wifiphisher/pywifiphisher.py setup.py changelog.md > /dev/null
git commit -m "chore:change release to ${new_version}" --quiet
git tag -a "v$new_version" -m "v$new_version"
git push new master --quiet
git push new --tags --quiet

# the sed in the data section removes all end of file ($) abd repleaces
# it with \n since json can only be only line
curl --silent --show-error -H "Authorization: token ${GH_TOKEN}" \
https://api.github.com/repos/wifiphisher/wifiphisher/releases -d \
"{
\"tag_name\": \"${new_version}\",
\"name\": \"${new_version} ${code_name}\",
\"body\": \"$(sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' temp_changelog.md)\",
\"draft\": false,
\"prerelease\": false
}" > /dev/null

echo -e "$(cat temp_changelog.md)\\n\\n$(cat changelog.md)" > changelog.md

echo -e "\\u25b7\\u25b7 Uploading to PYPI"
python setup.py sdist > /dev/null
twine upload dist/* -u "${PYPI_USERNAME}" -p "${PYPI_PASS}" > /dev/null
}

main
2 changes: 1 addition & 1 deletion wifiphisher/pywifiphisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def parse_args():
return parser.parse_args()


VERSION = "1.4GIT"
VERSION = "1.4"
args = parse_args()
APs = {} # for listing APs

Expand Down