Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sqlmapproject
GitHub Repository: sqlmapproject/sqlmap
Path: blob/master/extra/shutils/pypi.sh
3553 views
1
#!/bin/bash
2
set -euo pipefail
3
IFS=$'\n\t'
4
5
if [ ! -f ~/.pypirc ]; then
6
echo "File ~/.pypirc is missing"
7
exit 1
8
fi
9
10
declare -x SCRIPTPATH="${0}"
11
SETTINGS="${SCRIPTPATH%/*}/../../lib/core/settings.py"
12
VERSION=$(cat $SETTINGS | grep -E "^VERSION =" | cut -d '"' -f 2 | cut -d '.' -f 1-3)
13
TYPE=pip
14
TMP_DIR="$(mktemp -d -t pypi.XXXXXXXX)"
15
cleanup() { rm -rf -- "${TMP_DIR:?}"; }
16
trap cleanup EXIT
17
cd "$TMP_DIR"
18
cat > "$TMP_DIR/setup.py" << EOF
19
#!/usr/bin/env python
20
21
"""
22
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
23
See the file 'LICENSE' for copying permission
24
"""
25
26
from setuptools import setup, find_packages
27
28
setup(
29
name='sqlmap',
30
version='$VERSION',
31
description='Automatic SQL injection and database takeover tool',
32
long_description=open('README.rst').read(),
33
long_description_content_type='text/x-rst',
34
author='Bernardo Damele Assumpcao Guimaraes, Miroslav Stampar',
35
author_email='[email protected], [email protected]',
36
url='https://sqlmap.org',
37
project_urls={
38
'Documentation': 'https://github.com/sqlmapproject/sqlmap/wiki',
39
'Source': 'https://github.com/sqlmapproject/sqlmap/',
40
'Tracker': 'https://github.com/sqlmapproject/sqlmap/issues',
41
},
42
download_url='https://github.com/sqlmapproject/sqlmap/archive/$VERSION.zip',
43
license='GNU General Public License v2 (GPLv2)',
44
packages=['sqlmap'],
45
package_dir={'sqlmap':'sqlmap'},
46
include_package_data=True,
47
zip_safe=False,
48
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
49
classifiers=[
50
'Development Status :: 5 - Production/Stable',
51
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
52
'Natural Language :: English',
53
'Operating System :: OS Independent',
54
'Programming Language :: Python',
55
'Environment :: Console',
56
'Topic :: Database',
57
'Topic :: Security',
58
],
59
entry_points={
60
'console_scripts': [
61
'sqlmap = sqlmap.sqlmap:main',
62
],
63
},
64
)
65
EOF
66
wget "https://github.com/sqlmapproject/sqlmap/archive/$VERSION.zip" -O sqlmap.zip
67
unzip sqlmap.zip
68
rm sqlmap.zip
69
mv "sqlmap-$VERSION" sqlmap
70
cat > sqlmap/__init__.py << EOF
71
#!/usr/bin/env python
72
73
"""
74
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
75
See the file 'LICENSE' for copying permission
76
"""
77
78
import os
79
import sys
80
81
sys.dont_write_bytecode = True
82
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
83
EOF
84
cat > README.rst << "EOF"
85
sqlmap
86
======
87
88
|Python 2.7|3.x| |License| |X|
89
90
sqlmap is an open source penetration testing tool that automates the
91
process of detecting and exploiting SQL injection flaws and taking over
92
of database servers. It comes with a powerful detection engine, many
93
niche features for the ultimate penetration tester and a broad range of
94
switches lasting from database fingerprinting, over data fetching from
95
the database, to accessing the underlying file system and executing
96
commands on the operating system via out-of-band connections.
97
98
Screenshots
99
-----------
100
101
.. figure:: https://raw.github.com/wiki/sqlmapproject/sqlmap/images/sqlmap_screenshot.png
102
:alt: Screenshot
103
104
105
You can visit the `collection of
106
screenshots <https://github.com/sqlmapproject/sqlmap/wiki/Screenshots>`__
107
demonstrating some of features on the wiki.
108
109
Installation
110
------------
111
112
You can use pip to install and/or upgrade the sqlmap to latest (monthly) tagged version with: ::
113
114
pip install --upgrade sqlmap
115
116
Alternatively, you can download the latest tarball by clicking
117
`here <https://github.com/sqlmapproject/sqlmap/tarball/master>`__ or
118
latest zipball by clicking
119
`here <https://github.com/sqlmapproject/sqlmap/zipball/master>`__.
120
121
If you prefer fetching daily updates, you can download sqlmap by cloning the
122
`Git <https://github.com/sqlmapproject/sqlmap>`__ repository:
123
124
::
125
126
git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev
127
128
sqlmap works out of the box with
129
`Python <http://www.python.org/download/>`__ version **2.7** and
130
**3.x** on any platform.
131
132
Usage
133
-----
134
135
To get a list of basic options and switches use:
136
137
::
138
139
sqlmap -h
140
141
To get a list of all options and switches use:
142
143
::
144
145
sqlmap -hh
146
147
You can find a sample run `here <https://asciinema.org/a/46601>`__. To
148
get an overview of sqlmap capabilities, list of supported features and
149
description of all options and switches, along with examples, you are
150
advised to consult the `user's
151
manual <https://github.com/sqlmapproject/sqlmap/wiki/Usage>`__.
152
153
Links
154
-----
155
156
- Homepage: https://sqlmap.org
157
- Download:
158
`.tar.gz <https://github.com/sqlmapproject/sqlmap/tarball/master>`__
159
or `.zip <https://github.com/sqlmapproject/sqlmap/zipball/master>`__
160
- Commits RSS feed:
161
https://github.com/sqlmapproject/sqlmap/commits/master.atom
162
- Issue tracker: https://github.com/sqlmapproject/sqlmap/issues
163
- User's manual: https://github.com/sqlmapproject/sqlmap/wiki
164
- Frequently Asked Questions (FAQ):
165
https://github.com/sqlmapproject/sqlmap/wiki/FAQ
166
- X: https://x.com/sqlmap
167
- Demos: http://www.youtube.com/user/inquisb/videos
168
- Screenshots: https://github.com/sqlmapproject/sqlmap/wiki/Screenshots
169
170
.. |Python 2.7|3.x| image:: https://img.shields.io/badge/python-2.7|3.x-yellow.svg
171
:target: https://www.python.org/
172
.. |License| image:: https://img.shields.io/badge/license-GPLv2-red.svg
173
:target: https://raw.githubusercontent.com/sqlmapproject/sqlmap/master/LICENSE
174
.. |X| image:: https://img.shields.io/badge/[email protected]
175
:target: https://x.com/sqlmap
176
177
.. pandoc --from=markdown --to=rst --output=README.rst sqlmap/README.md
178
.. http://rst.ninjs.org/
179
EOF
180
sed -i "s/^VERSION =.*/VERSION = \"$VERSION\"/g" sqlmap/lib/core/settings.py
181
sed -i "s/^TYPE =.*/TYPE = \"$TYPE\"/g" sqlmap/lib/core/settings.py
182
: > MANIFEST.in
183
while IFS= read -r -d '' file; do
184
case "$file" in
185
*.git|*.yml) continue ;;
186
esac
187
echo "include $file" >> MANIFEST.in
188
done < <(find sqlmap -type f -print0)
189
python setup.py sdist bdist_wheel
190
twine check dist/*
191
twine upload --config-file=~/.pypirc dist/*
192
rm -rf "$TMP_DIR"
193
194