Skip to content

Instantly share code, notes, and snippets.

View 0xIslamTaha's full-sized avatar
🤩
code with love ... test with imagination

Islam Taha 0xIslamTaha

🤩
code with love ... test with imagination
View GitHub Profile
# Your machine is running zrobot in tmux
# bash: `zrobot server start -T http://github.com/zero-os/0-templates -T http://github.com/jumpscale/digital_me`
# You created a robot connected to this zrobot
# You need a ZOS machine registered to the capacity
# Both machines are in the same ZT NW
NODE_ID=''
ZT_ID=''
ZT_TOKEN=''
from js9 import j
FARMER_ID = ['xtremx']
NODES_STATUS = {}
for farmer in FARMER_ID:
NODES_STATUS[farmer] = []
grdi = j.clients.grid_capacity.get('main')
nodes, _ = gird.api.ListCapacity()
n [6]:
...: print(' [*] zboot client')
...: data = {
...: 'networkId': zt_nw_id,
...: 'sshClient' : 'zboot1-ssh', # ssh client instance name
...: 'zerotierClient': 'zboot1-zt', # zerotier client instance name
...: }
...: zboot_service = robot.services.create("github.com/zero-os/0-boot-templates/zeroboot_client/0.0.1", "zboot1-zb", data=data)
...: print(' [*] zboot client : zboot1-zb')
...:
import random
client_id = ''
client_secret = ''
account_name = ''
cs_name = ''
farmer_id = ''
zerotier_nw= ''
zeroOS = 'v.1.4.1'
@0xIslamTaha
0xIslamTaha / selenium_tricks.py
Last active August 2, 2018 11:33
selenium tricks
# upload file
from selenium import webdriver
url = 'https://files.fm/'
file_path = '/home/xtremx/Desktop/bg.png'
driver = webdriver.Chrome()
driver.get(url)
upload_elemnet = driver.find_element_by_xpath('//*[@id="uploadifive-file_upload"]/input[2]')
upload_elemnet.send_keys(file_path) # handle pop-up menu
remove key from `/root/jumpscale/cfg/jumpscale.tml`
```bash
ssh-add -D
ssh-add # to load ssh key
js_config init
```
"""
Pre-requests:
- zboot machine which is as an example:
- ubuntu machine 16.04
- Create a zerotier nw and connect to it
- Install JS9
- Install zrobot
- Run zrobot ex, `zrobot server start -D <zrobot-data-repo> -C <js9-config-repo> -T git@github.com:zero-os/0-boot-templates.git --auto-push`
Example: `zrobot server start -D ssh://git@docs.grid.tf:7022/kristof_farm/gent_0boot_zrobot.git -C ssh://git@docs.grid.tf:7022/kristof_farm/gent_0boot_config.git -T git@github.com:threefoldtech/0-templates.git --auto-push`
Example: ``
import crypt
from random import randint
SALT = '$6$wIzFEcUZ'
HASH = '$6$wIzFEcUZ$4cOcD5HtvTDHlb1maDoiT6wfWMz/tW2.R3ALRFOKdtRrn7bnHndKWMg33L1Hkkq5bX/l4/mor6M7GSguAKh5J.'
while True:
PW_PATTERN = "linux" + ''.join(["%s" % randint(0, 9) for num in range(0, 5)])
if crypt.crypt(PW_PATTERN, SALT) == HASH:
print(PW_PATTERN)
import requests
from jumpscale import j
client_id = ''
client_secret = ''
zt_nw_id = ''
farmer_id = ''
ipxe_url = 'ipxe: https://bootstrap.gig.tech/ipxe/development/{}/development%20farmer_id={}'.format(zt_nw_id, farmer_id)
data_new = requests.post('https://itsyou.online/v1/oauth/access_token?grant_type=client_credentials&client_id=%s&client_secret=%s&response_type=id_token' % (client_id, client_secret))
import requests, time, random
mykey = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjPfKUsaFuaGJsnHvF3k0PbqQTr3GL2pNuddn/xQjsroF35ELJVEovAsd9IlsFWOmDWlL6B+JYFgj8g5IykklHCDfmTu6LcGXjdfAYVp+eXARmgoCJKxVyenSVHu6No9O1e+QKFvMJTiJXdl08fZD1Fd2kRetDRKAijCZ76pmB4/KwVFiJKCVVdsDW/0R+td0gNVJyCQyRTcWEPmBfGMW/JrvRCSHfxlLdqsD3txLOm9pHlQ/LmEwOP3bqEEpQU1jP32JbdAdreuD6BYB+YRp02yyU33gd1QbqIEgftcN+6TuZJOU3j2VRSiUQX8h5SjtWV1UXE15ELlIlhcFJYH6L root@islamtaha-TT'
client_id = ''
client_secret = ''
packet_auth_token = ''
zt_token = ''
#ipxe = 'http://unsecure.bootstrap.gig.tech/ipxe/v1.2.2/9f77fc393e097c6e/console=ttyS1,115200%20development'
# ipxe_url = 'ipxe: http://unsecure.bootstrap.gig.tech/ipxe/v1.2.2/{}/console=ttyS1,115200%20development'