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
# python3 check_nodes_version.py -f 'kristof-farm' -c 'cb52b076df76c4da6be41999f65f87a047437f30'
from jumpscale import j
logger = j.logger.get('check_node_commit')
import click
@click.command()
@click.option("-f", "--farm_name", help="farm name to update its zrobot", required=True)
@click.option("-c", "--commit_id", help="match with this commit id", default='')
In [13]: j.builder.web.caddy.build(reset=True)
Sun07 17:13 uilderBaseClass.py - 185 - buildercaddy:buildercaddy : build profile path in:/tmp/builders/caddy/env.sh
Sun07 17:13 uilderBaseClass.py - 185 - buildergolang:buildergolang : build profile path in:/tmp/builders/go/env.sh
Sun07 17:13 uilderBaseClass.py - 220 - buildergolang:buildergolang : sandbox profile path in:/sandbox/env.sh
Sun07 17:13 BuilderTools.py - 176 - j.builder.tools:buildertools : curl -L 'https://dl.google.com/go/go1.12.linux-amd64.tar.gz' -o '/tmp/jumpscale/go1.12.linux-amd64.tar.gz' --connect-timeout 30 --retry 3 --retry-max-time 0
Sun07 17:13 BuilderTools.py - 692 - j.builder.tools:buildertools : curl -L 'https://dl.google.com/go/go1.12.linux-amd64.tar.gz' -o '/tmp/jumpscale/go1.12.linux-amd64.tar.gz' --connect-timeout 30 --retry 3 --retry-m
import math
import time
import requests
import gevent
import netaddr
from jumpscale import j
from zerorobot.service_collection import ServiceNotFoundError
from zerorobot.template.base import TemplateBase
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'
from jumpscale import j
from termcolor import colored
from random import randint
import click, uuid
# Templates
zerotier_template = "github.com/threefoldtech/0-templates/zerotier_client/0.0.1"
dm_vm_template = "github.com/threefoldtech/0-templates/dm_vm/0.0.1"
#python3 dm.py -r local -t ******* -i 35c192ce9ba98299 -n ac1f6b456b98 -im ubuntu -dt hdd -ds 5 -m 2048 -c 1 -s "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjPfKUsaFuaGJsnHvF3k0PbqQTr3GL2pNuddn/xQjsroF35ELJVEovAsd9IlsFWOmDWlL6B+JYFgj8g5IykklHCDfmTu6LcGXjdfAYVp+eXARmgoCJKxVyenSVHu6No9O1e+QKFvMJTiJXdl08fZD1Fd2kRetDRKAijCZ76pmB4/KwVFiJKCVVdsDW/0R+td0gNVJyCQyRTcWEPmBfGMW/JrvRCSHfxlLdqsD3txLOm9pHlQ/LmEwOP3bqEEpQU1jP32JbdAdreuD6BYB+YRp02yyU33gd1QbqIEgftcN+6TuZJOU3j2VRSiUQX8h5SjtWV1UXE15ELlIlhcFJYH6L root@islamtaha-TT"
@0xIslamTaha
0xIslamTaha / s3.py
Last active September 27, 2018 12:45
from jumpscale import j
import click, uuid, csv
from multiprocessing import Process, Manager
logger = j.logger.get('s3_deployment')
minio_results_file = 'minio_results_file.csv'
#python3 s3.py --robot local --s3_instances 1 --zt_token ****** --zt_nw_id 35c192ce9b3fecb5 --farmer_name tlre --storage_type hdd --storage_size 5 --minio_login minio_login --minio_password **
@click.command()
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)
"""
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 [email protected]:zero-os/0-boot-templates.git --auto-push`
Example: `zrobot server start -D ssh://[email protected]:7022/kristof_farm/gent_0boot_zrobot.git -C ssh://[email protected]:7022/kristof_farm/gent_0boot_config.git -T [email protected]:threefoldtech/0-templates.git --auto-push`
Example: ``
remove key from `/root/jumpscale/cfg/jumpscale.tml`
```bash
ssh-add -D
ssh-add # to load ssh key
js_config init
```
@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