Hack BroBeur

python script to make account at centre for logins.


In [7]:
from github import Github
import os 
import getpass
import git
import time
from clint.textui import colored
import dominate
from dominate.tags import *
import envoy

In [8]:
zeuser = getpass.getuser()

In [9]:
g = Github(zeuser, 'cancer123now!')

In [9]:


In [10]:
gitlist = []

In [11]:
searchpy = g.search_repositories(zeuser)

In [12]:
for pya in searchpy:
    print pya.full_name
    wcm = pya.full_name


---------------------------------------------------------------------------
BadCredentialsException                   Traceback (most recent call last)
<ipython-input-12-cd04b72a6252> in <module>()
----> 1 for pya in searchpy:
      2     print pya.full_name
      3     wcm = pya.full_name

/usr/local/lib/python2.7/dist-packages/github/PaginatedList.pyc in __iter__(self)
     46             yield element
     47         while self._couldGrow():
---> 48             newElements = self._grow()
     49             for element in newElements:
     50                 yield element

/usr/local/lib/python2.7/dist-packages/github/PaginatedList.pyc in _grow(self)
     58 
     59     def _grow(self):
---> 60         newElements = self._fetchNextPage()
     61         self.__elements += newElements
     62         return newElements

/usr/local/lib/python2.7/dist-packages/github/PaginatedList.pyc in _fetchNextPage(self)
    156             "GET",
    157             self.__nextUrl,
--> 158             parameters=self.__nextParams
    159         )
    160 

/usr/local/lib/python2.7/dist-packages/github/Requester.pyc in requestJsonAndCheck(self, verb, url, parameters, headers, input, cnx)
    167 
    168     def requestJsonAndCheck(self, verb, url, parameters=None, headers=None, input=None, cnx=None):
--> 169         return self.__check(*self.requestJson(verb, url, parameters, headers, input, cnx))
    170 
    171     def requestMultipartAndCheck(self, verb, url, parameters=None, headers=None, input=None):

/usr/local/lib/python2.7/dist-packages/github/Requester.pyc in __check(self, status, responseHeaders, output)
    175         output = self.__structuredFromJson(output)
    176         if status >= 400:
--> 177             raise self.__createException(status, responseHeaders, output)
    178         return responseHeaders, output
    179 

BadCredentialsException: 401 {u'documentation_url': u'https://developer.github.com/v3', u'message': u'Bad credentials'}

In [ ]:
for repo in g.get_user('wcmckee').get_repos():
    gitlist.append(repo.name)

In [ ]:
os.mkdir('/home/wcmckee/github')

In [13]:
lisdir = os.listdir('/home/wcmckee/github/')

In [14]:
lisdir


Out[14]:
[]

In [15]:
curlis = []

In [16]:
for lis in lisdir:
    curlis.append(ls)

In [17]:
dlrepo = list(set(gitlist) - set(curlis))

In [18]:
print dlrepo


[]

In [19]:
wafi = time.sleep(5)

In [21]:
import sh

In [22]:
import git
repo = git.Repo( '/home/wcmckee/learnpython' )
print repo.git.status()


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-22-17f4f7b6ca52> in <module>()
      1 import git
----> 2 repo = git.Repo( '/home/wcmckee/learnpython' )
      3 print repo.git.status()

AttributeError: 'module' object has no attribute 'Repo'

In [23]:
assert repo.bare == False


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-23-bdeffb08b22d> in <module>()
----> 1 assert repo.bare == False

NameError: name 'repo' is not defined

In [24]:
ycmds = ['git', 'clone', ']


  File "<ipython-input-24-a53437f23170>", line 1
    ycmds = ['git', 'clone', ']
                              ^
SyntaxError: EOL while scanning string literal

In [25]:
%%bash
df


Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/vda        20509308 8708728  10735724  45% /
none                   4       0         4   0% /sys/fs/cgroup
udev              240136       4    240132   1% /dev
tmpfs              50188     312     49876   1% /run
none                5120       0      5120   0% /run/lock
none              250940       0    250940   0% /run/shm
none              102400       0    102400   0% /run/user

In [110]:
pwd


Out[110]:
u'/home/wcmckee/brobeur-web'

In [ ]:
import git
os.chdir()

In [26]:
for gitbl in dlrepo:
    print (colored.red('Downloading - ' + (colored.blue('wcmckee') + ' - ' + gitbl)))
    #git.Git().clone("https://github.com/wcmckee/" + gitbl)
    envoy.run('git clone https://github.com/wcmckee/' + gitbl )
    t = envoy.run('df')
    t.std_out
    print ('Download complete. Waiting 5 secs till the next')
    wafi

In [104]:
from paramiko import SSHClient
from scp import SCPClient

ssh = SSHClient()
ssh.load_system_host_keys()
ssh.connect('example.com')


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-104-40cc5821b00c> in <module>()
----> 1 from paramiko import SSHClient
      2 from scp import SCPClient
      3 
      4 ssh = SSHClient()
      5 ssh.load_system_host_keys()

ImportError: No module named paramiko

In [27]:
import subprocess

In [27]:


In [28]:
%%bash 
source `dirname $0`/github-config.sh


bash: line 1: ./github-config.sh: No such file or directory

In [28]:


In [29]:
cmdrun = ['sudo', 'pip', 'install', 'paramiko']

In [30]:
supi = envoy.run(cmdrun)


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-30-e04bc577db2a> in <module>()
----> 1 supi = envoy.run(cmdrun)

/usr/local/lib/python2.7/dist-packages/envoy/core.pyc in run(command, data, timeout)
    165 
    166         cmd = Command(c)
--> 167         out, err = cmd.run(data, timeout)
    168 
    169         r = Response(process=cmd)

/usr/local/lib/python2.7/dist-packages/envoy/core.pyc in run(self, data, timeout)
     50             self.process.terminate()
     51             thread.join()
---> 52         self.returncode = self.process.returncode
     53         return self.out, self.err
     54 

AttributeError: 'NoneType' object has no attribute 'returncode'
Exception in thread Thread-7:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/envoy/core.py", line 40, in target
    bufsize=0,
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory


In [ ]:
insvn = subprocess.check_output(cmdrun)

In [31]:
newlis = []

In [32]:
for repoz in g.get_user('wcmckee').get_repos():
                        newlis.append(repo.name)


---------------------------------------------------------------------------
BadCredentialsException                   Traceback (most recent call last)
<ipython-input-32-1abdc7fdffa8> in <module>()
----> 1 for repoz in g.get_user('wcmckee').get_repos():
      2                         newlis.append(repo.name)

/usr/local/lib/python2.7/dist-packages/github/MainClass.pyc in get_user(self, login)
    155             headers, data = self.__requester.requestJsonAndCheck(
    156                 "GET",
--> 157                 "/users/" + login
    158             )
    159             return github.NamedUser.NamedUser(self.__requester, headers, data, completed=True)

/usr/local/lib/python2.7/dist-packages/github/Requester.pyc in requestJsonAndCheck(self, verb, url, parameters, headers, input, cnx)
    167 
    168     def requestJsonAndCheck(self, verb, url, parameters=None, headers=None, input=None, cnx=None):
--> 169         return self.__check(*self.requestJson(verb, url, parameters, headers, input, cnx))
    170 
    171     def requestMultipartAndCheck(self, verb, url, parameters=None, headers=None, input=None):

/usr/local/lib/python2.7/dist-packages/github/Requester.pyc in __check(self, status, responseHeaders, output)
    175         output = self.__structuredFromJson(output)
    176         if status >= 400:
--> 177             raise self.__createException(status, responseHeaders, output)
    178         return responseHeaders, output
    179 

BadCredentialsException: 401 {u'documentation_url': u'https://developer.github.com/v3', u'message': u'Bad credentials'}

In [33]:
gitlist


Out[33]:
[]

In [34]:
ls


adypost.ipynb      hackbrobeur.py  opche.py         Untitled1.py        wallpapersav.py
adypost.py         huluz.py        pyatakl.ipynb    Untitled2.ipynb     wcmdocker.ipynb
brief.txt          index.html      pyatakl.py       Untitled2.py        wcmdocker.py
carparks           __init__.py     rgdsnatch.ipynb  Untitled3.ipynb     wcmgit.ipynb
digzocean.html     job.sh*         rgdsnatch.py*    Untitled3.py        wcmgit.py
digzocean.ipynb    markdown.ipynb  style.css        Untitled4.ipynb     whai.ipynb
digzocean.py       markdown.py     test.html        Untitled4.py        whai.py
flask-test.ipynb   metatime.ipynb  test.ipynb       url redirect.ipynb  wiki.md
flask-test.py      metatime.py     test.py          url redirect.py
getdrawn.ipynb     nbconv.ipynb    Untitled0.ipynb  utils.ipynb
getdrawn.py*       nbconv.py       Untitled0.py     utils.py
hackbrobeur.ipynb  opche.ipynb     Untitled1.ipynb  wallpapersav.ipynb

In [35]:
cd brobeur-web/


[Errno 2] No such file or directory: 'brobeur-web/'
/home/wcmckee/pyatakl/pyatakl

In [36]:
minex = open(')


  File "<ipython-input-36-ebb5b1ca215d>", line 1
    minex = open(')
                  ^
SyntaxError: EOL while scanning string literal

In [37]:
indop = open('index.html', 'r')

In [37]:


In [38]:
indop.read()


Out[38]:
''

In [42]:
from paramiko import SSHClient
from scp import SCPClient

ssh = SSHClient()
ssh.load_system_host_keys()
ssh.connect('example.com')


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-42-40cc5821b00c> in <module>()
----> 1 from paramiko import SSHClient
      2 from scp import SCPClient
      3 
      4 ssh = SSHClient()
      5 ssh.load_system_host_keys()

/usr/local/lib/python2.7/dist-packages/paramiko/__init__.py in <module>()
     29 
     30 
---> 31 from paramiko.transport import SecurityOptions, Transport
     32 from paramiko.client import SSHClient, MissingHostKeyPolicy, AutoAddPolicy, RejectPolicy, WarningPolicy
     33 from paramiko.auth_handler import AuthHandler

/usr/local/lib/python2.7/dist-packages/paramiko/transport.py in <module>()
     45     MSG_CHANNEL_EOF, MSG_CHANNEL_CLOSE
     46 from paramiko.compress import ZlibCompressor, ZlibDecompressor
---> 47 from paramiko.dsskey import DSSKey
     48 from paramiko.kex_gex import KexGex
     49 from paramiko.kex_group1 import KexGroup1

/usr/local/lib/python2.7/dist-packages/paramiko/dsskey.py in <module>()
     24 from hashlib import sha1
     25 
---> 26 from Crypto.PublicKey import DSA
     27 
     28 from paramiko import util

ImportError: No module named Crypto.PublicKey

In [43]:
import envoy

In [44]:
import clon


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-44-03f0f5bba302> in <module>()
----> 1 import clon

ImportError: No module named clon

In [44]:


In [ ]: