How to use check_call method in robotframework-androidlibrary

Best Python code snippet using robotframework-androidlibrary_python

dyan.py

Source:dyan.py Github

copy

Full Screen

...193 for process in process_list:194 match = regexp.search(process)195 if match:196 pid = match.group('pid')197 subprocess.check_call([self.host_vmrun_path, "-T", self.host_vmtype, "-gu", self.username, "-gp", self.password, "killProcessInGuest", self.vmpath, pid])198 def execute_file(self, mal_file, args):199 cmd = [self.host_vmrun_path, "-T", self.host_vmtype,"-gu", self.username, "-gp", self.password, "runProgramInGuest", self.vmpath, '-nowait', '-activeWindow', '-interactive',200 mal_file]201 cmd.extend(args)202 subprocess.check_call(cmd)203 def execute_sysdig(self, sysdig_file, cap_filter, cap_out_file, filter_file_name):204 cap_filter = cap_filter + " " + "and (proc.name=" + filter_file_name + " " + "or proc.aname=" + filter_file_name + ")"205 subprocess.check_call([self.host_vmrun_path, "-T", self.host_vmtype,"-gu", self.username, "-gp", self.password, "runProgramInGuest", self.vmpath, '-noWait', '-activeWindow', '-interactive',206 sysdig_file, cap_filter, "-w", cap_out_file])207 def execute_sysdig_full(self, sysdig_file, cap_out_file, filter_file_name):208 cap_filter = "proc.name=" + filter_file_name + " " + "or proc.aname=" + filter_file_name209 subprocess.check_call([self.host_vmrun_path, "-T", self.host_vmtype, "-gu", self.username, "-gp", self.password, "runProgramInGuest", self.vmpath, '-noWait', '-activeWindow', '-interactive',210 sysdig_file, cap_filter, "-w", cap_out_file])211 def execute_strace(self, strace_path, strace_out_file, strace_filter, print_hexdump, mal_file, args):212 if print_hexdump:213 cmd = [self.host_vmrun_path, "-T", self.host_vmtype,"-gu", self.username, "-gp", self.password, "runProgramInGuest", self.vmpath, '-noWait', '-activeWindow', '-interactive',214 strace_path, "-o", strace_out_file, strace_filter, "-s", "64", "-eread=all", "-ewrite=all", "-f", mal_file]215 else:216 cmd = [self.host_vmrun_path, "-T", self.host_vmtype,"-gu", self.username, "-gp", self.password, "runProgramInGuest", self.vmpath, '-noWait', '-activeWindow', '-interactive',217 strace_path, "-o", strace_out_file, strace_filter, "-s", "216", "-f", mal_file]218 cmd.extend(args)219 subprocess.check_call(cmd)220 def execute_strace_full(self, strace_path, strace_out_file, print_hexdump, mal_file, args):221 if print_hexdump:222 cmd = [self.host_vmrun_path, "-T", self.host_vmtype,"-gu", self.username, "-gp", self.password, "runProgramInGuest", self.vmpath, '-noWait', '-activeWindow', '-interactive',223 strace_path, "-o", strace_out_file, "-s", "64", "-eread=all", "-ewrite=all", "-f", mal_file]224 else:225 cmd = [self.host_vmrun_path, "-T", self.host_vmtype,"-gu", self.username, "-gp", self.password, "runProgramInGuest", self.vmpath, '-noWait', '-activeWindow', '-interactive',226 strace_path, "-o", strace_out_file, "-s", "216", "-f", mal_file]227 cmd.extend(args)228 subprocess.check_call(cmd)229 def read_capture_and_dump(self, host_sysdig_path, capture_out_file, capture_out_txt_file, cap_format):230 cap_format = '"' + cap_format + '"'231 cmd = host_sysdig_path + " " + "-p" + cap_format + " " + "-r" + " " + capture_out_file + " > " + capture_out_txt_file232 p = subprocess.Popen(cmd, shell=True)233 p.wait()234 def get_calltrace_activity(self, outfile_path):235 results = open(outfile_path).read()236 return results237#######################################[end of vmware class]###################################238import xmlrpclib239#######################################[virtualbox class]######################################240class Virtualbox:241 def __init__(self, vm_guid):242 self.vm_guid = vm_guid243 self.xmlrpc = None244 self.dict_pid = {}245 def set_credentials(self, ip, port):246 print ("# connect %s:%s" % (ip, port))247 self.xmlrpc = xmlrpclib.ServerProxy('http://%s:%s' % (ip, port))248 def revert_current(self):249 print ("# revert snapshot guid: %s" % self.vm_guid)250 proc = subprocess.Popen(["VBoxManage", "snapshot", self.vm_guid, "restorecurrent"], stdout=subprocess.PIPE)251 vm_stdout = proc.communicate()[0]252 print vm_stdout253 def start(self):254 print ("# start vbox guid: %s" % self.vm_guid)255 proc = subprocess.Popen(["VBoxManage", "startvm", self.vm_guid, "--type", "headless"], stdout=subprocess.PIPE)256 vm_stdout = proc.communicate()[0]257 print vm_stdout258 def copytovm(self, src, dst):259 print ("# copy %s to %s" % (src, dst))260 return self.xmlrpc.copyto(xmlrpclib.Binary(open(src, "rb").read()), dst)261 def copyfromvm(self, src, dst):262 print ("# get vm file %s as %s" % (src, dst))263 data = self.xmlrpc.copyfrom(src)264 if data:265 open(dst, "wb+").write(data.data)266 if dst.endswith('.scap'):267 os.system("mv %s %s.gz;gunzip %s.gz" % (dst, dst, dst))268 return True269 else:270 return False271 def capturescreen(self, dst):272 proc = subprocess.Popen(["VBoxManage", "controlvm", self.vm_guid, "screenshotpng", dst], stdout=subprocess.PIPE)273 vm_stdout = proc.communicate()[0]274 print vm_stdout275 def suspend(self):276 proc = subprocess.Popen(["VBoxManage", "controlvm", self.vm_guid, "pause"], stdout=subprocess.PIPE)277 vm_stdout = proc.communicate()[0]278 print vm_stdout279 def get_vmmem(self):280 print ("# get vbox coredump")281 proc = subprocess.Popen(["VBoxManage", "debugvm", self.vm_guid, "dumpguestcore", "--filename", "%s.elf" % self.vm_guid], stdout=subprocess.PIPE)282 vm_stdout = proc.communicate()[0]283 print vm_stdout284 return "%s.elf"%self.vm_guid285 def stop(self):286 proc = subprocess.Popen(["VBoxManage", "controlvm", self.vm_guid, "poweroff"], stdout=subprocess.PIPE)287 vm_stdout = proc.communicate()[0]288 print vm_stdout289 # List directory in guest290 def list_dir(self, dir_name):291 print ("# get dir_list %s" % dir_name)292 return self.xmlrpc.listDirectoryInGuest(dir_name)293 # get .log, .txt and .csv related to dtrace and nori from log directory294 def get_log_files_from_dir_list(self, dir_list):295 log_files = []296 for each_file in dir_list:297 value = each_file.find(".scap")298 value1 = each_file.find(".txt")299 if value != -1 or value1 != -1:300 log_files.append(each_file)301 return log_files302 def stop_sysdig(self):303 print ("# stop sysdig")304 for item in self.dict_pid:305 pid = self.dict_pid[item]306 try:307 self.xmlrpc.killProcessInGuest(pid)308 except Exception as e:309 print e310 def execute_file(self, mal_file, args):311 pid = self.xmlrpc.runProgramInGuest(mal_file, args)312 if pid:313 print ("execute_file pid: %s" % pid)314 else:315 print ("execute_file failed")316 def execute_sysdig(self, sysdig_file, cap_filter, cap_out_file, filter_file_name):317 cap_filter = cap_filter + " " + "and (proc.name=" + filter_file_name[:15] + " " + "or proc.aname=" + filter_file_name[:15] + ")"318 pid = self.xmlrpc.runProgramInGuest(sysdig_file, [cap_filter, "-z", "-w", cap_out_file])319 if pid:320 print ("execute_sysdig pid: %s" % pid)321 self.dict_pid[sysdig_file] = pid322 else:323 print ("execute_sysdig failed")324 def execute_sysdig_full(self, sysdig_file, cap_out_file, filter_file_name):325 cap_filter = "proc.name=" + filter_file_name[15] + " " + "or proc.aname=" + filter_file_name[:15]326 pid = self.xmlrpc.runProgramInGuest(sysdig_file, [cap_filter, "-z", "-w", cap_out_file])327 if pid:328 print ("execute_sysdig_full pid: %s" % pid)329 self.dict_pid[sysdig_file] = pid330 else:331 print ("execute_sysdig_full failed")332 def execute_strace(self, strace_path, strace_out_file, strace_filter, print_hexdump, mal_file, args):333 if print_hexdump:334 cmd = ["-o", strace_out_file, strace_filter, "-s", "64", "-eread=all", "-ewrite=all", "-f", mal_file]335 else:336 cmd = ["-o", strace_out_file, strace_filter, "-s", "216", "-f", mal_file]337 cmd.extend(args)338 pid = self.xmlrpc.runProgramInGuest(strace_path, cmd)339 if pid:340 print ("execute_strace pid: %s" % pid)341 else:342 print ("execute_strace failed")343 def execute_strace_full(self, strace_path, strace_out_file, print_hexdump, mal_file, args):344 if print_hexdump:345 cmd = ["-o", strace_out_file, "-s", "64", "-eread=all", "-ewrite=all", "-f", mal_file]346 else:347 cmd = ["-o", strace_out_file, "-s", "216", "-f", mal_file]348 cmd.extend(args)349 pid = self.xmlrpc.runProgramInGuest(strace_path, cmd)350 if pid:351 print ("execute_strace_full pid: %s" % pid)352 else:353 print ("execute_strace_full failed")354 def read_capture_and_dump(self, host_sysdig_path, capture_out_file, capture_out_txt_file, cap_format):355 print ("# read_capture_and_dump ")356 cap_format = '"' + cap_format + '"'357 cmd = host_sysdig_path + " " + "-p" + cap_format + " " + "-r" + " " + capture_out_file + " > " + capture_out_txt_file358 p = subprocess.Popen(cmd, shell=True)359 p.wait()360 def get_calltrace_activity(self, outfile_path):361 results = open(outfile_path).read()362 return results363 def get_guest_logs(self):364 print self.xmlrpc.get_logs()365#######################################[end of virtualbox class]###################################366########################################[tshark class]#########################################367class Tshark:368 def __init__(self, tshark_path, out_pcap):369 if not os.path.isfile(tshark_path):370 print "cannot find tshark in %s" % tshark_path371 print "Exiting the program"372 sys.exit()373 self.tshark_path = tshark_path374 self.out_pcap = out_pcap375 self.proc = None376 def start_tshark(self, iface, ip):377 self.proc = subprocess.Popen([self.tshark_path, '-i', iface, '-w', self.out_pcap, '-f', 'host %s' % ip])378 def stop_tshark(self):379 if self.proc != None:380 self.proc.terminate()381 def dns_summary(self):382 proc = subprocess.Popen([self.tshark_path, '-r', self.out_pcap, '-R', "dns.qry.name"], stdout = subprocess.PIPE)383 dns_queries = proc.communicate()[0]384 return dns_queries385 def tcp_conv(self):386 proc = subprocess.Popen([self.tshark_path,'-z', 'conv,tcp', '-r', self.out_pcap, '-q', '-n'], stdout = subprocess.PIPE)387 tcp_conversations = proc.communicate()[0]388 return tcp_conversations389 def http_requests(self):390 proc = subprocess.Popen([self.tshark_path, '-r', self.out_pcap, '-R', "http.request", '-Tfields', '-e','ip.src', '-e', 'ip.dst', '-e', 'http.host'], stdout = subprocess.PIPE)391 http_requests = proc.communicate()[0]392 return http_requests393 def httpreq_tree(self):394 proc = subprocess.Popen(['tshark', '-z', 'http_req,tree', '-r', self.out_pcap, '-q', '-n'], stdout = subprocess.PIPE)395 http_request_tree = proc.communicate()[0]396 return http_request_tree397########################################[end of tshark class]######################################398########################################[tcpdump class]############################################399class Tcpdump:400 def __init__(self, tcpdump_path, out_pcap):401 if not os.path.isfile(tcpdump_path):402 print "cannot find tcpdump in %s" % tcpdump_path403 print "Exiting the program"404 sys.exit()405 self.tcpdump_path = tcpdump_path406 self.out_pcap = out_pcap407 self.proc = None408 def start_tcpdump(self, iface, ip):409 self.proc = subprocess.Popen([self.tcpdump_path, '-n', '-i', iface, 'host %s' % ip, '-w', self.out_pcap])410 def stop_tcpdump(self):411 if self.proc != None:412 self.proc.terminate()413 def dns_summary(self):414 proc = subprocess.Popen([self.tcpdump_path, '-n', '-r', self.out_pcap, "udp and port 53"], stdout=subprocess.PIPE)415 dns_queries = proc.communicate()[0]416 return dns_queries417 def tcp_conv(self):418 proc = subprocess.Popen([self.tcpdump_path,'-n', '-q', '-r', self.out_pcap, "tcp"], stdout=subprocess.PIPE)419 tcp_conversations = proc.communicate()[0]420 return tcp_conversations421########################################[end of tcpdump class]######################################422########################################[fileregmon class]##########################################423class Fileregmon:424 def __init__(self, host_vmrun_path, host_vmtype, vmpath, username, password):425 self.host_vmrun_path = host_vmrun_path426 self.host_vmtype = host_vmtype427 self.vmpath = vmpath428 self.username = username429 self.password = password430 self.file_path = ""431 def get_filereg_activity(self, outfile_path):432 results = open(outfile_path).read()433 return results434#############################################[end of fileregmon class]############################435########################################[iptables class]##########################################436class Iptables:437 def __init__(self, iface):438 self.iface = iface439 def add_ip_port_redirect_entries(self):440 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "2:6", "-j", "REDIRECT", "--to-port", "1"])441 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "8", "-j", "REDIRECT", "--to-port", "1"])442 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "10:12", "-j", "REDIRECT", "--to-port", "1"])443 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "14:16", "-j", "REDIRECT", "--to-port", "1"])444 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "18", "-j", "REDIRECT", "--to-port", "1"])445 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "20:36", "-j", "REDIRECT", "--to-port", "1"])446 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "38:52", "-j", "REDIRECT", "--to-port", "1"])447 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "54:68", "-j", "REDIRECT", "--to-port", "1"])448 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "70:122", "-j", "REDIRECT", "--to-port", "1"])449 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "124:513", "-j", "REDIRECT", "--to-port", "1"])450 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "515:65535", "-j", "REDIRECT", "--to-port", "1"])451 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "7", "-j", "REDIRECT", "--to-port", "7"])452 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "9", "-j", "REDIRECT", "--to-port", "9"])453 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "13", "-j", "REDIRECT", "--to-port", "13"])454 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "17", "-j", "REDIRECT", "--to-port", "17"])455 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "19", "-j", "REDIRECT", "--to-port", "19"])456 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "37", "-j", "REDIRECT", "--to-port", "37"])457 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "53", "-j", "REDIRECT", "--to-port", "53"])458 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "69", "-j", "REDIRECT", "--to-port", "69"])459 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "123", "-j", "REDIRECT", "--to-port", "123"])460 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "514", "-j", "REDIRECT", "--to-port", "514"])461 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "2:6", "-j", "REDIRECT", "--to-port", "1"])462 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "8:12", "-j", "REDIRECT", "--to-port", "1"])463 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "14:16", "-j", "REDIRECT", "--to-port", "1"])464 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "18", "-j", "REDIRECT", "--to-port", "1"])465 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "20", "-j", "REDIRECT", "--to-port", "1"])466 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "22:24", "-j", "REDIRECT", "--to-port", "1"])467 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "26:36", "-j", "REDIRECT", "--to-port", "1"])468 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "38:52", "-j", "REDIRECT", "--to-port", "1"])469 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "54:78", "-j", "REDIRECT", "--to-port", "1"])470 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "81:109", "-j", "REDIRECT", "--to-port", "1"])471 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "111:112", "-j", "REDIRECT", "--to-port", "1"])472 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "114:442", "-j", "REDIRECT", "--to-port", "1"])473 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "444:464", "-j", "REDIRECT", "--to-port", "1"])474 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "466:989", "-j", "REDIRECT", "--to-port", "1"])475 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "991:994", "-j", "REDIRECT", "--to-port", "1"])476 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "996:6666", "-j", "REDIRECT", "--to-port", "1"])477 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "6668:65535", "-j", "REDIRECT", "--to-port", "1"])478 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "7", "-j", "REDIRECT", "--to-port", "7"])479 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "13", "-j", "REDIRECT", "--to-port", "13"])480 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "17", "-j", "REDIRECT", "--to-port", "17"])481 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "19", "-j", "REDIRECT", "--to-port", "19"])482 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "21", "-j", "REDIRECT", "--to-port", "21"])483 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "25", "-j", "REDIRECT", "--to-port", "25"])484 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "37", "-j", "REDIRECT", "--to-port", "37"])485 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "53", "-j", "REDIRECT", "--to-port", "53"])486 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "79", "-j", "REDIRECT", "--to-port", "79"])487 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "80", "-j", "REDIRECT", "--to-port", "80"])488 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "110", "-j", "REDIRECT", "--to-port", "110"])489 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "113", "-j", "REDIRECT", "--to-port", "113"])490 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "443", "-j", "REDIRECT", "--to-port", "443"])491 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "465", "-j", "REDIRECT", "--to-port", "465"])492 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "990", "-j", "REDIRECT", "--to-port", "990"])493 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "995", "-j", "REDIRECT", "--to-port", "995"])494 subprocess.check_call(["iptables", "-A", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "6667", "-j", "REDIRECT", "--to-port", "6667"])495 def delete_ip_port_redirect_entries(self):496 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "2:6", "-j", "REDIRECT", "--to-port", "1"])497 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "8", "-j", "REDIRECT", "--to-port", "1"])498 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "10:12", "-j", "REDIRECT", "--to-port", "1"])499 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "14:16", "-j", "REDIRECT", "--to-port", "1"])500 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "18", "-j", "REDIRECT", "--to-port", "1"])501 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "20:36", "-j", "REDIRECT", "--to-port", "1"])502 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "38:52", "-j", "REDIRECT", "--to-port", "1"])503 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "54:68", "-j", "REDIRECT", "--to-port", "1"])504 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "70:122", "-j", "REDIRECT", "--to-port", "1"])505 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "124:513", "-j", "REDIRECT", "--to-port", "1"])506 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "515:65535", "-j", "REDIRECT", "--to-port", "1"])507 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "7", "-j", "REDIRECT", "--to-port", "7"])508 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "9", "-j", "REDIRECT", "--to-port", "9"])509 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "13", "-j", "REDIRECT", "--to-port", "13"])510 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "17", "-j", "REDIRECT", "--to-port", "17"])511 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "19", "-j", "REDIRECT", "--to-port", "19"])512 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "37", "-j", "REDIRECT", "--to-port", "37"])513 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "53", "-j", "REDIRECT", "--to-port", "53"])514 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "69", "-j", "REDIRECT", "--to-port", "69"])515 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "123", "-j", "REDIRECT", "--to-port", "123"])516 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "udp", "--dport", "514", "-j", "REDIRECT", "--to-port", "514"])517 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "2:6", "-j", "REDIRECT", "--to-port", "1"])518 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "8:12", "-j", "REDIRECT", "--to-port", "1"])519 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "14:16", "-j", "REDIRECT", "--to-port", "1"])520 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "18", "-j", "REDIRECT", "--to-port", "1"])521 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "20", "-j", "REDIRECT", "--to-port", "1"])522 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "22:24", "-j", "REDIRECT", "--to-port", "1"])523 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "26:36", "-j", "REDIRECT", "--to-port", "1"])524 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "38:52", "-j", "REDIRECT", "--to-port", "1"])525 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "54:78", "-j", "REDIRECT", "--to-port", "1"])526 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "81:109", "-j", "REDIRECT", "--to-port", "1"])527 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "111:112", "-j", "REDIRECT", "--to-port", "1"])528 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "114:442", "-j", "REDIRECT", "--to-port", "1"])529 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "444:464", "-j", "REDIRECT", "--to-port", "1"])530 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "466:989", "-j", "REDIRECT", "--to-port", "1"])531 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "991:994", "-j", "REDIRECT", "--to-port", "1"])532 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "996:6666", "-j", "REDIRECT", "--to-port", "1"])533 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "6668:65535", "-j", "REDIRECT", "--to-port", "1"])534 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "7", "-j", "REDIRECT", "--to-port", "7"])535 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "13", "-j", "REDIRECT", "--to-port", "13"])536 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "17", "-j", "REDIRECT", "--to-port", "17"])537 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "19", "-j", "REDIRECT", "--to-port", "19"])538 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "21", "-j", "REDIRECT", "--to-port", "21"])539 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "25", "-j", "REDIRECT", "--to-port", "25"])540 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "37", "-j", "REDIRECT", "--to-port", "37"])541 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "53", "-j", "REDIRECT", "--to-port", "53"])542 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "79", "-j", "REDIRECT", "--to-port", "79"])543 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "80", "-j", "REDIRECT", "--to-port", "80"])544 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "110", "-j", "REDIRECT", "--to-port", "110"])545 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "113", "-j", "REDIRECT", "--to-port", "113"])546 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "443", "-j", "REDIRECT", "--to-port", "443"])547 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "465", "-j", "REDIRECT", "--to-port", "465"])548 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "990", "-j", "REDIRECT", "--to-port", "990"])549 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "995", "-j", "REDIRECT", "--to-port", "995"])550 subprocess.check_call(["iptables", "-D", "PREROUTING", "-t", "nat", "-i", self.iface, "-p", "tcp", "--dport", "6667", "-j", "REDIRECT", "--to-port", "6667"])551 def display_ip_port_redirect_entries(self):552 output = subprocess.check_output(["iptables", "-L", "-t" "nat"])553 print output...

Full Screen

Full Screen

gitian-build.py

Source:gitian-build.py Github

copy

Full Screen

...18 print('Cannot find any way to install docker', file=sys.stderr)19 exit(1)20 else:21 programs += ['lxc', 'debootstrap']22 subprocess.check_call(['sudo', 'apt-get', 'install', '-qq'] + programs)23 if not os.path.isdir('gitian.sigs'):24 subprocess.check_call(['git', 'clone', 'https://github.com/bitcoin-core/gitian.sigs.git'])25 if not os.path.isdir('bitcoin-detached-sigs'):26 subprocess.check_call(['git', 'clone', 'https://github.com/bitcoin-core/bitcoin-detached-sigs.git'])27 if not os.path.isdir('gitian-builder'):28 subprocess.check_call(['git', 'clone', 'https://github.com/devrandom/gitian-builder.git'])29 if not os.path.isdir('bitcoin'):30 subprocess.check_call(['git', 'clone', 'https://github.com/bitcoin/bitcoin.git'])31 os.chdir('gitian-builder')32 make_image_prog = ['bin/make-base-vm', '--suite', 'bionic', '--arch', 'amd64']33 if args.docker:34 make_image_prog += ['--docker']35 elif not args.kvm:36 make_image_prog += ['--lxc']37 subprocess.check_call(make_image_prog)38 os.chdir(workdir)39 if args.is_bionic and not args.kvm and not args.docker:40 subprocess.check_call(['sudo', 'sed', '-i', 's/lxcbr0/br0/', '/etc/default/lxc-net'])41 print('Reboot is required')42 exit(0)43def build():44 global args, workdir45 os.makedirs('bitcoin-binaries/' + args.version, exist_ok=True)46 print('\nBuilding Dependencies\n')47 os.chdir('gitian-builder')48 os.makedirs('inputs', exist_ok=True)49 subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://downloads.sourceforge.net/project/osslsigncode/osslsigncode/osslsigncode-1.7.1.tar.gz'])50 subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://bitcoincore.org/cfields/osslsigncode-Backports-to-1.7.1.patch'])51 subprocess.check_call(["echo 'a8c4e9cafba922f89de0df1f2152e7be286aba73f78505169bc351a7938dd911 inputs/osslsigncode-Backports-to-1.7.1.patch' | sha256sum -c"], shell=True)52 subprocess.check_call(["echo 'f9a8cdb38b9c309326764ebc937cba1523a3a751a7ab05df3ecc99d18ae466c9 inputs/osslsigncode-1.7.1.tar.gz' | sha256sum -c"], shell=True)53 subprocess.check_call(['make', '-C', '../bitcoin/depends', 'download', 'SOURCES_PATH=' + os.getcwd() + '/cache/common'])54 if args.linux:55 print('\nCompiling ' + args.version + ' Linux')56 subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'bitcoin='+args.commit, '--url', 'bitcoin='+args.url, '../bitcoin/contrib/gitian-descriptors/gitian-linux.yml'])57 subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-linux', '--destination', '../gitian.sigs/', '../bitcoin/contrib/gitian-descriptors/gitian-linux.yml'])58 subprocess.check_call('mv build/out/bitcoin-*.tar.gz build/out/src/bitcoin-*.tar.gz ../bitcoin-binaries/'+args.version, shell=True)59 if args.windows:60 print('\nCompiling ' + args.version + ' Windows')61 subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'bitcoin='+args.commit, '--url', 'bitcoin='+args.url, '../bitcoin/contrib/gitian-descriptors/gitian-win.yml'])62 subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-win-unsigned', '--destination', '../gitian.sigs/', '../bitcoin/contrib/gitian-descriptors/gitian-win.yml'])63 subprocess.check_call('mv build/out/bitcoin-*-win-unsigned.tar.gz inputs/', shell=True)64 subprocess.check_call('mv build/out/bitcoin-*.zip build/out/bitcoin-*.exe ../bitcoin-binaries/'+args.version, shell=True)65 if args.macos:66 print('\nCompiling ' + args.version + ' MacOS')67 subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'bitcoin='+args.commit, '--url', 'bitcoin='+args.url, '../bitcoin/contrib/gitian-descriptors/gitian-osx.yml'])68 subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-osx-unsigned', '--destination', '../gitian.sigs/', '../bitcoin/contrib/gitian-descriptors/gitian-osx.yml'])69 subprocess.check_call('mv build/out/bitcoin-*-osx-unsigned.tar.gz inputs/', shell=True)70 subprocess.check_call('mv build/out/bitcoin-*.tar.gz build/out/bitcoin-*.dmg ../bitcoin-binaries/'+args.version, shell=True)71 os.chdir(workdir)72 if args.commit_files:73 print('\nCommitting '+args.version+' Unsigned Sigs\n')74 os.chdir('gitian.sigs')75 subprocess.check_call(['git', 'add', args.version+'-linux/'+args.signer])76 subprocess.check_call(['git', 'add', args.version+'-win-unsigned/'+args.signer])77 subprocess.check_call(['git', 'add', args.version+'-osx-unsigned/'+args.signer])78 subprocess.check_call(['git', 'commit', '-m', 'Add '+args.version+' unsigned sigs for '+args.signer])79 os.chdir(workdir)80def sign():81 global args, workdir82 os.chdir('gitian-builder')83 if args.windows:84 print('\nSigning ' + args.version + ' Windows')85 subprocess.check_call('cp inputs/bitcoin-' + args.version + '-win-unsigned.tar.gz inputs/bitcoin-win-unsigned.tar.gz', shell=True)86 subprocess.check_call(['bin/gbuild', '-i', '--commit', 'signature='+args.commit, '../bitcoin/contrib/gitian-descriptors/gitian-win-signer.yml'])87 subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-win-signed', '--destination', '../gitian.sigs/', '../bitcoin/contrib/gitian-descriptors/gitian-win-signer.yml'])88 subprocess.check_call('mv build/out/bitcoin-*win64-setup.exe ../bitcoin-binaries/'+args.version, shell=True)89 subprocess.check_call('mv build/out/bitcoin-*win32-setup.exe ../bitcoin-binaries/'+args.version, shell=True)90 if args.macos:91 print('\nSigning ' + args.version + ' MacOS')92 subprocess.check_call('cp inputs/bitcoin-' + args.version + '-osx-unsigned.tar.gz inputs/bitcoin-osx-unsigned.tar.gz', shell=True)93 subprocess.check_call(['bin/gbuild', '-i', '--commit', 'signature='+args.commit, '../bitcoin/contrib/gitian-descriptors/gitian-osx-signer.yml'])94 subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-osx-signed', '--destination', '../gitian.sigs/', '../bitcoin/contrib/gitian-descriptors/gitian-osx-signer.yml'])95 subprocess.check_call('mv build/out/bitcoin-osx-signed.dmg ../bitcoin-binaries/'+args.version+'/bitcoin-'+args.version+'-osx.dmg', shell=True)96 os.chdir(workdir)97 if args.commit_files:98 print('\nCommitting '+args.version+' Signed Sigs\n')99 os.chdir('gitian.sigs')100 subprocess.check_call(['git', 'add', args.version+'-win-signed/'+args.signer])101 subprocess.check_call(['git', 'add', args.version+'-osx-signed/'+args.signer])102 subprocess.check_call(['git', 'commit', '-a', '-m', 'Add '+args.version+' signed binary sigs for '+args.signer])103 os.chdir(workdir)104def verify():105 global args, workdir106 os.chdir('gitian-builder')107 print('\nVerifying v'+args.version+' Linux\n')108 subprocess.check_call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-linux', '../bitcoin/contrib/gitian-descriptors/gitian-linux.yml'])109 print('\nVerifying v'+args.version+' Windows\n')110 subprocess.check_call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-win-unsigned', '../bitcoin/contrib/gitian-descriptors/gitian-win.yml'])111 print('\nVerifying v'+args.version+' MacOS\n')112 subprocess.check_call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-osx-unsigned', '../bitcoin/contrib/gitian-descriptors/gitian-osx.yml'])113 print('\nVerifying v'+args.version+' Signed Windows\n')114 subprocess.check_call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-win-signed', '../bitcoin/contrib/gitian-descriptors/gitian-win-signer.yml'])115 print('\nVerifying v'+args.version+' Signed MacOS\n')116 subprocess.check_call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-osx-signed', '../bitcoin/contrib/gitian-descriptors/gitian-osx-signer.yml'])117 os.chdir(workdir)118def main():119 global args, workdir120 parser = argparse.ArgumentParser(usage='%(prog)s [options] signer version')121 parser.add_argument('-c', '--commit', action='store_true', dest='commit', help='Indicate that the version argument is for a commit or branch')122 parser.add_argument('-p', '--pull', action='store_true', dest='pull', help='Indicate that the version argument is the number of a github repository pull request')123 parser.add_argument('-u', '--url', dest='url', default='https://github.com/bitcoin/bitcoin', help='Specify the URL of the repository. Default is %(default)s')124 parser.add_argument('-v', '--verify', action='store_true', dest='verify', help='Verify the Gitian build')125 parser.add_argument('-b', '--build', action='store_true', dest='build', help='Do a Gitian build')126 parser.add_argument('-s', '--sign', action='store_true', dest='sign', help='Make signed binaries for Windows and MacOS')127 parser.add_argument('-B', '--buildsign', action='store_true', dest='buildsign', help='Build both signed and unsigned binaries')128 parser.add_argument('-o', '--os', dest='os', default='lwm', help='Specify which Operating Systems the build is for. Default is %(default)s. l for Linux, w for Windows, m for MacOS')129 parser.add_argument('-j', '--jobs', dest='jobs', default='2', help='Number of processes to use. Default %(default)s')130 parser.add_argument('-m', '--memory', dest='memory', default='2000', help='Memory to allocate in MiB. Default %(default)s')131 parser.add_argument('-k', '--kvm', action='store_true', dest='kvm', help='Use KVM instead of LXC')132 parser.add_argument('-d', '--docker', action='store_true', dest='docker', help='Use Docker instead of LXC')133 parser.add_argument('-S', '--setup', action='store_true', dest='setup', help='Set up the Gitian building environment. Uses LXC. If you want to use KVM, use the --kvm option. Only works on Debian-based systems (Ubuntu, Debian)')134 parser.add_argument('-D', '--detach-sign', action='store_true', dest='detach_sign', help='Create the assert file for detached signing. Will not commit anything.')135 parser.add_argument('-n', '--no-commit', action='store_false', dest='commit_files', help='Do not commit anything to git')136 parser.add_argument('signer', help='GPG signer to sign each build assert file')137 parser.add_argument('version', help='Version number, commit, or branch to build. If building a commit or branch, the -c option must be specified')138 args = parser.parse_args()139 workdir = os.getcwd()140 args.linux = 'l' in args.os141 args.windows = 'w' in args.os142 args.macos = 'm' in args.os143 args.is_bionic = b'bionic' in subprocess.check_output(['lsb_release', '-cs'])144 if args.buildsign:145 args.build=True146 args.sign=True147 if args.kvm and args.docker:148 raise Exception('Error: cannot have both kvm and docker')149 args.sign_prog = 'true' if args.detach_sign else 'gpg --detach-sign'150 # Set environment variable USE_LXC or USE_DOCKER, let gitian-builder know that we use lxc or docker151 if args.docker:152 os.environ['USE_DOCKER'] = '1'153 elif not args.kvm:154 os.environ['USE_LXC'] = '1'155 if not 'GITIAN_HOST_IP' in os.environ.keys():156 os.environ['GITIAN_HOST_IP'] = '10.0.3.1'157 if not 'LXC_GUEST_IP' in os.environ.keys():158 os.environ['LXC_GUEST_IP'] = '10.0.3.5'159 # Disable for MacOS if no SDK found160 if args.macos and not os.path.isfile('gitian-builder/inputs/MacOSX10.11.sdk.tar.gz'):161 print('Cannot build for MacOS, SDK does not exist. Will build for other OSes')162 args.macos = False163 script_name = os.path.basename(sys.argv[0])164 # Signer and version shouldn't be empty165 if args.signer == '':166 print(script_name+': Missing signer.')167 print('Try '+script_name+' --help for more information')168 exit(1)169 if args.version == '':170 print(script_name+': Missing version.')171 print('Try '+script_name+' --help for more information')172 exit(1)173 # Add leading 'v' for tags174 if args.commit and args.pull:175 raise Exception('Cannot have both commit and pull')176 args.commit = ('' if args.commit else 'v') + args.version177 if args.setup:178 setup()179 os.chdir('bitcoin')180 if args.pull:181 subprocess.check_call(['git', 'fetch', args.url, 'refs/pull/'+args.version+'/merge'])182 os.chdir('../gitian-builder/inputs/bitcoin')183 subprocess.check_call(['git', 'fetch', args.url, 'refs/pull/'+args.version+'/merge'])184 args.commit = subprocess.check_output(['git', 'show', '-s', '--format=%H', 'FETCH_HEAD'], universal_newlines=True, encoding='utf8').strip()185 args.version = 'pull-' + args.version186 print(args.commit)187 subprocess.check_call(['git', 'fetch'])188 subprocess.check_call(['git', 'checkout', args.commit])189 os.chdir(workdir)190 if args.build:191 build()192 if args.sign:193 sign()194 if args.verify:195 verify()196if __name__ == '__main__':...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run robotframework-androidlibrary automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful