Beispiel #1
0
 def shoot(self, event):
     if (self.id == 1):
         if (event.key == pygame.K_SPACE):
             return Shell(self.pointA[0], self.pointA[1], self.theta)
     elif (self.id == 2):
         if (event.key == pygame.K_KP_ENTER):
             return Shell(self.pointA[0], self.pointA[1], self.theta)
Beispiel #2
0
 def externals_property(self):
     if self._externals_property == None:
         propget_cmd = Shell(verbose=False, fatal=True).run(
             'svn pg --xml svn:externals "{0}"'.format(self.url))
         contents_xml = propget_cmd.output_xml()
         self._externals_property = contents_xml.findtext('target/property')
     return self._externals_property
Beispiel #3
0
def main():
    try:
        shell = Shell(sys.stdin, sys.stdout)
    except ShellError as e:
        print(e.error)
        return 1
    shell.run()
Beispiel #4
0
def collecting_traffic(name):
    print(str(name) + ' Thread starts')
    shell = Shell()

    shell.execute(
        "echo \"1234\" | sudo -S tcpdump -i any -v -G 20 not arp and not src 127.0.0.1 and not dst 127.0.0.1 -w data-%S.pcap"
    )
Beispiel #5
0
 def StorePackageHashes(self, projectPathSrc, username, projectname,
                        branchname):
     shell = Shell(Logger())
     con = Database(self.config)
     for dir in os.listdir(projectPathSrc):
         if os.path.isdir(projectPathSrc + "/" + dir):
             packagename = os.path.basename(dir)
             # update hash of each package
             cmd = "find " + projectPathSrc + "/" + dir + " -type f -print0 | sort -z | xargs -0 sha1sum | sha1sum | awk '{print $1}'"
             hash = shell.evaluateshell(cmd)
             # print(packagename + " " + hash)
             cursor = con.execute(
                 "SELECT * FROM package WHERE username = ? AND projectname = ? AND packagename = ? AND branchname = ?",
                 (username, projectname, packagename, branchname))
             row = cursor.fetchone()
             alreadyuptodate = False
             idToUpdate = None
             if row is not None:
                 if row['sourcehash'] == hash:
                     alreadyuptodate = True
                 else:
                     idToUpdate = row['id']
             if not alreadyuptodate:
                 if idToUpdate is None:
                     stmt = "INSERT INTO package(username, projectname, packagename, branchname, sourcehash) VALUES(?,?,?,?,?)"
                     cursor = con.execute(stmt,
                                          (username, projectname,
                                           packagename, branchname, hash))
                 else:
                     stmt = "UPDATE package SET sourcehash = ? WHERE id = ?"
                     cursor = con.execute(stmt, (hash, idToUpdate))
                     self.MarkPackageAsDirty(con, idToUpdate)
                 con.commit()
     con.close()
Beispiel #6
0
 def fire(self):
     if self.ready_to_fire:
         self.ready_to_fire = False
         self.count = 0
         s = Shell((sf.Texture.from_file("res/Shell.png")))
         s.setup(self, self.get_forward_point())
         self.shells.append(s)
         self.shells_fired += 1
Beispiel #7
0
def command():
    id = bottle.request.forms.shellid
    cmd = bottle.request.forms.command
    path = bottle.request.forms.path
    shellinfo = get_shell_from_id(id)
    shell = Shell(shellinfo['url'], shellinfo['pwd'], shellinfo['plugin'],
                  shellinfo['method'], shellinfo['coding'])
    return shell.execute_command(cmd, path)
Beispiel #8
0
def collecting_traffic(name):
    print(str(name)+ ' Thread starts')
    shell = Shell()
    net_data = NetworkData()

    ip = net_data.get_host_ip()
    net = ipaddress.ip_network(ip, strict=False)
    shell.execute("echo \"1996\" | sudo -S tcpdump -i any -v -G 20 net " + str(net) + " -w data-%S.pcap")
Beispiel #9
0
def delfile():
    id = bottle.request.forms.shellid
    filename = bottle.request.forms.filename
    path = bottle.request.forms.path
    shellinfo = get_shell_from_id(id)
    shell = Shell(shellinfo['url'], shellinfo['pwd'], shellinfo['plugin'],
                  shellinfo['method'], shellinfo['coding'])
    return shell.del_file(filename, path)
Beispiel #10
0
def createfolder():
    id = bottle.request.forms.shellid
    foldername = bottle.request.forms.foldername
    path = bottle.request.forms.path
    shellinfo = get_shell_from_id(id)
    shell = Shell(shellinfo['url'], shellinfo['pwd'], shellinfo['plugin'],
                  shellinfo['method'], shellinfo['coding'])
    return shell.mkdir(foldername, path)
Beispiel #11
0
def collecting_traffic(name):
    print(str(name) + ' Thread starts')
    shell = Shell()
    shell.execute("echo \"abcd\" | sudo -S rm *.csv")
    shell.execute("echo \"abcd\" | sudo -S rm *.pcap")
    shell.execute("echo \"abcd\" | sudo -S stop my")
    shell.execute(
        "echo \"abcd\" | sudo -S tcpdump -i any -v -G 20 not arp and not src 10.3.0.24 and not src 127.0.0.1 and not "
        "dst 10.3.0.24 and not dst 127.0.0.1 -w data-%S.pcap")
Beispiel #12
0
def start(argv=None, **kwds):
    """general-purpose entry point for applications"""
    cls = kwds.get('applicationClass')
    kwds = dict(**kwds)
    kwds['argv'] = argv
    app = cls()
    shell = Shell(app)
    shell.run(**kwds)
    return 0
Beispiel #13
0
    def test(self, _, input_string, output_string):
        input_stream = io.StringIO(input_string)
        output_stream = io.StringIO()

        # noinspection PyTypeChecker
        shell = Shell(input_stream, output_stream)

        shell.run()

        self.assertEqual(output_string, output_stream.getvalue())
    def testDefault(self):
        test = Shell(cmd="echo 123")
        test.run_background()

        for i in range(3):
            time.sleep(1)

        self.assertTrue(test.is_terminate())

        output = test.get_output()
        self.assertTrue(output.startswith("123"))
    def testTerminate(self):
        test = Shell(cmd="calc")
        test.run_background()

        for i in range(2):
            time.sleep(1)

        test.terminate()
        time.sleep(1)

        self.assertTrue(test.is_terminate())
 def create_run_shell(exe_name, interpreter, question, param=[]):
     Log.compile_log('RUN: create run file')
     scale = 1
     suffix = ''
     interpreter_value = ''
     exe_sentence = 'time ('
     if len(param) > 0:
         exe_sentence += 'echo '
         for item in param:
             exe_sentence += (str(item) + ' ')
         exe_sentence += ' | '
     if interpreter.upper() == 'C' or interpreter.upper() == 'CPP':
         interpreter_value = ''
     elif interpreter.upper() == 'PY':
         interpreter_value = 'python'
         scale = 3
         suffix = '.py'
     elif interpreter.upper() == 'JAVA':
         interpreter_value = 'java'
         scale = 2
         suffix = '.java'
     Log.compile_log('RUN: Get interpreter value')
     exe_sentence += (interpreter_value + ' .' + DATA.DOCKER_EXES_PATH +
                      '/' + exe_name + suffix + ' )')
     Log.compile_log('RUN: The Exesentence is : ' + exe_sentence)
     # 生成编译的sh文件
     try:
         Log.compile_log('RUN: create file and write data')
         shell = Shell(name='run_' + exe_name + '_' + interpreter + '.sh',
                       path=DATA.HOST_SHELL_PATH)
         Log.compile_log('RUN: ' + shell.get_path() + '/' +
                         shell.get_name())
         run_file = open(shell.get_path() + '/' + shell.get_name(), "w")
         run_file.write('#! /bin/bash\n')
         run_file.write('ulimit -s -t ' + str(question.get_time() * scale) +
                        '\n')
         run_file.write(exe_sentence + '\n')
         run_file.close()
         Log.compile_log('RUN: write data over')
         Popen("chmod 777 " + shell.get_path() + '/' + shell.get_name(),
               shell=True,
               stdin=PIPE,
               stdout=PIPE,
               close_fds=True)
     except Exception, e:
         run_file.close()
         Log.compile_log('RUN: The error is : ' + e.message)
         error_log = run_file(
             DATA.HOST_ERROR_LOG_PATH + '/create_run_shell_' +
             str(time.time()) + str(random.randint(1000, 9999)) + '.log',
             'w')
         error_log.write(e.message)
         error_log.close()
         return None
Beispiel #17
0
def uploadfile():
    id = bottle.request.forms.shellid
    path = bottle.request.forms.path
    formfile = bottle.request.files.file
    formfile.save('./upload', overwrite=True)
    shellinfo = get_shell_from_id(id)
    shell = Shell(shellinfo['url'], shellinfo['pwd'], shellinfo['plugin'],
                  shellinfo['method'], shellinfo['coding'])
    info = shell.upload_file('./upload/%s' % formfile.filename, path)
    os.remove('./upload/%s' % formfile.filename)
    return info
Beispiel #18
0
def getfilelist():
    shellid = bottle.request.forms.shellid
    path = bottle.request.forms.path
    shellinfo = get_shell_from_id(shellid)
    shell = Shell(shellinfo['url'], shellinfo['pwd'], shellinfo['plugin'],
                  shellinfo['method'], shellinfo['coding'])
    info = {
        'sysinfo': shell.get_sys_info(),
        'filelist': shell.get_dir(path),
    }
    return info
    def __init__(self, containername, configBuildMachine, logger,
                 packageSrcPath, containertype):
        self.hostname = containername
        self.containertype = containertype
        self.staticMachine = (True if ('static' in configBuildMachine
                                       and configBuildMachine['static'] == "t")
                              else False)

        self.port = "22"
        if configBuildMachine['port'] is not None:
            self.port = str(configBuildMachine['port'])
        self.cid = 10
        if configBuildMachine['cid'] is not None:
            self.cid = configBuildMachine['cid']

        self.containername = str(self.cid).zfill(3) + "-" + containername
        if containertype == "lxd":
            self.containername = "l" + str(
                self.cid).zfill(3) + "-" + containername.replace(".", "-")

        self.containerIP = socket.gethostbyname(self.hostname)
        self.containerPort = str(2000 + int(self.cid))

        if configBuildMachine['local'] is not None and configBuildMachine[
                'local'] == "t":
            # the host server for the build container is actually hosting the LBS application as well
            # or the container is running on localhost
            if containertype == "lxc":
                self.containerIP = self.calculateLocalContainerIP(self.cid)
                self.containerPort = "22"
            if containertype == "lxd":
                self.containerIP = self.calculateLocalContainerIP(self.cid)
                self.containerPort = "22"
            if containertype == "docker":
                self.containerIP = self.calculateLocalContainerIP(1)
                self.containerPort = str(2000 + int(self.cid))

        self.config = Config.LoadConfig()
        self.SSHContainerPath = self.config['lbs']['SSHContainerPath']
        self.logger = logger
        self.shell = Shell(logger)
        # we are reusing the slots, for caches etc
        self.slot = containername
        self.distro = ""
        self.release = ""
        self.arch = ""
        self.staticIP = ""
        self.packageSrcPath = packageSrcPath
Beispiel #20
0
    def subdirectories(self):
        if self._subdirectories == None:
            self._subdirectories = []
            contents_xml = Shell(verbose=False).run(
                'svn ls --xml "{0}"'.format(self.url)).output_xml()
            for element in contents_xml.find('list').findall('entry'):
                if not element.get('kind') == 'dir':
                    continue
                name = element.findtext('name')
                subdirectory_url = os.path.join(self.url, name)
                subdirectory = SVNDirectory(subdirectory_url, parent=self)
                if subdirectory.should_ignore():
                    continue
                self._subdirectories.append(subdirectory)

        return self._subdirectories
Beispiel #21
0
def main(args=None):
    """
   Entry point for both command-line and shell

   Note that the `args` parameter to this function allows us to do
   stuff from the Python interactive prompt:

   >>> Main.main(['-H', 'pivot02', 'getstate', 'mabramow-test1'])
   getstate(mabramow-test1) = off

   Inspiration from http://www.artima.com/weblogs/viewpost.jsp?thread=4829
   """

    try:
        options, args = optionsParser.parser.parse_args(args or sys.argv[1:])
        if options.serverOp: args.insert(0, options.serverOp)

        host = GetHost(options)

        if options.interactive:
            Shell(host).cmdloop()
        else:
            operationName, result = CommandProcessor.Process(host, args)
            if result is not None:
                result = TaskManager().HandleIfTask(result, async=False)

                if not options.quiet:
                    if isinstance(result, basestring) or \
                       isinstance(result, int) or isinstance(result, long):
                        sys.stdout.write(GetPrologue(operationName, args))

                if result == 'success': result = 1
                if result == 'error': result = 0

                print(optionsParser.GetFormatter(options).Format(result))
    except CommandProcessor.InvalidOperation:
        sys.stderr.write('Invalid operation specified.\n\n')
        optionsParser.parser.print_help()
        sys.stderr.write('\nInvalid operation specified.\n')
    except CommandProcessor.InvalidParameter, e:
        sys.stderr.write('Invalid parameter specified.\n\n')
        sys.stderr.write('%s\n' % e)
 def create_compile_shell(code_name, exe_name, compile_type):
     Log.compile_log('Compile: create compile file')
     shell = Shell(name='compile_' + code_name + '_' + exe_name + '_' +
                   compile_type + '.sh',
                   path=DATA.HOST_SHELL_PATH)
     # 生成编译的sh文件
     compile_name = ''
     if compile_type.upper() == 'C':
         compile_name = 'gcc ' + DATA.DOCKER_CODES_PATH + '/' + code_name + '.c -o ' \
                        + DATA.DOCKER_EXES_PATH + '/' + exe_name
     elif compile_type.upper() == 'CPP':
         compile_name = 'g++ ' + DATA.DOCKER_CODES_PATH + '/' + code_name + '.cpp -o ' \
                        + DATA.DOCKER_EXES_PATH + '/' + exe_name
     elif compile_type.upper() == 'JAVA':
         compile_name = 'javac ' + DATA.DOCKER_CODES_PATH + '/' + code_name + '.java\n'
         compile_name += 'mv ' + DATA.DOCKER_CODES_PATH + '/' + exe_name + '.class ' + DATA.DOCKER_EXES_PATH
     elif compile_type.upper() == 'PY':
         compile_name = 'cp ' + DATA.DOCKER_CODES_PATH + '/' + code_name + '.py ' + DATA.DOCKER_EXES_PATH
     Log.compile_log('Compile: Get Compile Name')
     try:
         Log.compile_log('Compile: Create file and write data')
         compile_file = open(shell.get_path() + '/' + shell.get_name(), 'w')
         compile_file.write("#! /bin/bash\n")
         compile_file.write(compile_name + '\n')
         compile_file.write("if [ \"$?\" = \"0\" ]\n")
         compile_file.write("then echo 'success'\nelse\necho 'fail'\nfi")
         compile_file.close()
         Log.compile_log('Compile: write data over')
         os.system("chmod 777 " + shell.get_path() + '/' + shell.get_name())
     except Exception, e:
         compile_file.close()
         print e.message
         error_log = compile_file(
             DATA.HOST_ERROR_LOG_PATH + '/create_compile_shell_' +
             str(time.time()) + str(random.randint(1000, 9999)) + '.log',
             'w')
         error_log.write(e.message)
         error_log.close()
         return None
Beispiel #23
0
class methods:
    def __init__(self, fps, clockObject, surface, font, bars, windowsize):
        self.fps = fps
        self.clock = clockObject
        self.surface = surface
        self.font = font
        self.bars = bars
        self.windowsize = windowsize

    def get_array(self, length, mode=0):
        arr = list(range(length))

        if not mode:
            random.shuffle(arr)
        elif mode == 2:
            arr = arr[::-1]
        elif mode == 3:
            for i in range(length - 1):
                if random.randint(0, 10) < 8:
                    tmp = random.randint(4, 15)
                    try:
                        arr[i], arr[i + tmp] = arr[i + tmp], arr[i]
                    except:
                        pass

        return arr

    def setup(self, length, mode=0):
        self.array = self.get_array(length, mode)

        self.display = Display(self.windowsize[0] / length, self.windowsize,
                               self.surface, self.font)
        self.accesses = 0
        self.comparisons = 0

        setattr(self.display, "bars", self.bars)

    bubble = lambda self: Bubble(self.array, self.display, self.clock, self.fps
                                 ).main()
    quicksort = lambda self: Quicksort(self.array, self.display, self.clock,
                                       self.fps).main()
    selection = lambda self: Selection(self.array, self.display, self.clock,
                                       self.fps).main()
    cocktail = lambda self: Cocktail(self.array, self.display, self.clock, self
                                     .fps).main()
    bogo = lambda self: Bogo(self.array, self.display, self.clock, self.fps
                             ).main()
    oddeven = lambda self: Oddeven(self.array, self.display, self.clock, self.
                                   fps).main()
    shell = lambda self: Shell(self.array, self.display, self.clock, self.fps
                               ).main()
    comb = lambda self: Comb(self.array, self.display, self.clock, self.fps
                             ).main()
    insertion = lambda self: Insertion(self.array, self.display, self.clock,
                                       self.fps).main()
    mergetd = lambda self: MergeTD(self.array, self.display, self.clock, self.
                                   fps).main()
    radixlsd = lambda self: RadixLSD(self.array, self.display, self.clock, self
                                     .fps).main()
    counting = lambda self: Counting(self.array, self.display, self.clock, self
                                     .fps).main()
    cycle = lambda self: Cycle(self.array, self.display, self.clock, self.fps
                               ).main()
    heap = lambda self: Heap(self.array, self.display, self.clock, self.fps
                             ).main()
    circle = lambda self: Circle(self.array, self.display, self.clock, self.fps
                                 ).main()
    gnome = lambda self: Gnome(self.array, self.display, self.clock, self.fps
                               ).main()
    binaryinsertion = lambda self: BinaryInsertion(
        self.array, self.display, self.clock, self.fps).main()
    pancake = lambda self: Pancake(self.array, self.display, self.clock, self.
                                   fps).main()
    permutation = lambda self: Permutation(self.array, self.display, self.
                                           clock, self.fps).main()
    strand = lambda self: Strand(self.array, self.display, self.clock, self.fps
                                 ).main()
    bucket = lambda self: Bucket(self.array, self.display, self.clock, self.fps
                                 ).main()
    minmax = lambda self: MinMax(self.array, self.display, self.clock, self.fps
                                 ).main()
    mergebu = lambda self: MergeBU(self.array, self.display, self.clock, self.
                                   fps).main()
    bitonic = lambda self: Bitonic(self.array, self.display, self.clock, self.
                                   fps).main()
    stooge = lambda self: Stooge(self.array, self.display, self.clock, self.fps
                                 ).main()
    smooth = lambda self: Smooth(self.array, self.display, self.clock, self.fps
                                 ).main()
    quick3 = lambda self: Quick3(self.array, self.display, self.clock, self.fps
                                 ).main()
Beispiel #24
0
def main():
    # width = 1200
    # height = 850
    width = 700
    height = 600
    blue_color = (97, 159, 182)

    pygame.init()
    screen = pygame.display.set_mode((width, height))
    pygame.display.set_caption('Tanks')
    clock = pygame.time.Clock()
    background = pygame.image.load('images/background_desert1.png')
    background = pygame.transform.scale(background, (width,height))
    the_player = Player("images/tank_bottom_new_cropped3.png", "images/tank_top_new_cropped7.png", 350, 350, screen)
    #do we even need this?
    players = Group()
    players.add(the_player)
    #
    square = Block( 200, 200, (0,0,0) , 50, 50, screen)
    players.add(square)
    
    shells = Group()

    #what does this do???? 
    # player_group = Group()
    # player_group.add(the_player)

    # Game initialization

    # gameStart()
    
    stop_game = False
    while not stop_game:
        for event in pygame.event.get():
            key.move_forward_pressed()
            # Event handling

            if event.type == pygame.QUIT:
                stop_game = True

            if key.move_forward_pressed():
                the_player.move_up()
            if key.move_back_pressed():
                the_player.move_down()
            if not key.move_back_pressed() and not key.move_forward_pressed():
                the_player.stop() 

            if key.turn_left_pressed():
                the_player.turn_left()
            if key.turn_right_pressed():
                the_player.turn_right()
            if not key.turn_left_pressed() and not key.turn_right_pressed():
                the_player.stop_turn()    

            if event.type == pygame.MOUSEBUTTONDOWN:
                # print math.fabs((pygame.mouse.get_pos()[0] - the_player.x) / math.cos(the_player.top_angle_rad))
                x2 = pygame.mouse.get_pos()[0]
                y2 = pygame.mouse.get_pos()[1]
                
                current_tick = pygame.time.get_ticks()
                

                if (current_tick - the_player.last_shot_tick) > the_player.cool_down:

                
                    shot_length = math.sqrt((x2 - the_player.x)**2 +(y2 - the_player.y)**2)
                    # print shot_length
                    if shot_length > 85:
                        new_shell = Shell("images/tank_shell5.png", screen, the_player)   #tank_shell1_cropped.png
                        # shells.add(new_shell)
                        the_player.last_shot_tick = new_shell.shot_start_tick
                        if new_shell.shot_length == new_shell.shot_length_current:
                            del new_shell
                    
                        

                # elif current_tick - the_player.last_shot_tick < 175:
                #     screen.blit()
                # the_player.shoot()
                # if event.key          
            # if event.type == pygame.KEYUP:
                        
            #     the_player.bottom_angle += 3
           
        # Game logic
        the_player.update(players)
        

        # Draw background
   
        screen.blit(background, [0,0])
        
        
        

       
        

        # Game display
        square.render(the_player)
        the_player.draw_me()

        #shell display
        for shell in shells:
            shell.update(the_player, players)
            shell.draw_shot()
            # if shell.beyond_screen():
            #     shells.remove(shell)
                #or if shell reached mouse_pos
                
        pygame.display.update()
        clock.tick(60)

    pygame.quit()
 def __init__(self, queue):
     self.queue = queue
     self.shell = Shell()
Beispiel #26
0
    def getPackagingInstructionsInternal(self, userconfig, username,
                                         projectname, branchname,
                                         gitprojectname, lbsproject, pathSrc):
        os.makedirs(pathSrc, exist_ok=True)

        needToDownload = True

        #we want a clean clone
        #but do not delete the tree if it is being used by another build
        t = None
        if os.path.isfile(pathSrc + 'lbs-' + projectname + '-lastused'):
            t = os.path.getmtime(pathSrc + 'lbs-' + projectname + '-lastused')
            # delete the tree only if it has not been used within the last 3 minutes
            if (time.time() - t) < 3 * 60:
                needToDownload = False
            # update the timestamp
            os.utime(pathSrc + 'lbs-' + projectname + '-lastused')
        else:
            open(pathSrc + 'lbs-' + projectname + '-lastused', 'a').close()

        headers = {}
        if not 'GitType' in userconfig or userconfig['GitType'] == 'github':
            url = lbsproject + "/archive/" + branchname + ".tar.gz"
        elif userconfig['GitType'] == 'gitlab':
            url = lbsproject + "/repository/archive.tar.gz?ref=" + branchname
            tokenfilename = self.config["lbs"][
                "SSHContainerPath"] + "/" + username + "/" + projectname + "/gitlab_token"
            if os.path.isfile(tokenfilename):
                with open(tokenfilename, "r") as myfile:
                    headers['PRIVATE-TOKEN'] = myfile.read().strip()

        # check if the version we have is still uptodate
        etagFile = pathSrc + 'lbs-' + projectname + '-etag'
        if needToDownload and os.path.isfile(etagFile):
            with open(etagFile, 'r') as content_file:
                Etag = content_file.read()
                headers['If-None-Match'] = Etag
            r = requests.get(url, headers=headers)
            if 'Etag' in r.headers and r.headers['Etag'] == '"' + Etag + '"':
                needToDownload = False

        if not needToDownload and os.path.isdir(pathSrc + 'lbs-' +
                                                projectname):
            # we can reuse the existing source, it was used just recently, or has not changed on the server
            self.StorePackageHashes(pathSrc + 'lbs-' + projectname, username,
                                    projectname, branchname)
            return

        # delete the working tree
        if os.path.isdir(pathSrc + 'lbs-' + projectname):
            shutil.rmtree(pathSrc + 'lbs-' + projectname)

        sourceFile = pathSrc + "/" + branchname + ".tar.gz"
        if os.path.isfile(sourceFile):
            os.remove(sourceFile)
        r = requests.get(url, headers=headers)
        if r.status_code == 401:
            raise Exception(
                "problem downloading the repository, access denied")
        elif not r.status_code == 200:
            raise Exception("problem downloading the repository " + url +
                            ", HTTP error code " + str(r.status_code))

        chunk_size = 100000
        with open(sourceFile, 'wb') as fd:
            for chunk in r.iter_content(chunk_size):
                fd.write(chunk)
        if 'Etag' in r.headers:
            Etag = r.headers['Etag']
            with open(etagFile, 'w') as fd:
                fd.write(Etag.strip('"'))

        shell = Shell(Logger())
        if not 'GitType' in userconfig or userconfig['GitType'] == 'github':
            cmd = "cd " + pathSrc + ";"
            cmd += "tar xzf " + branchname + ".tar.gz; mv lbs-" + gitprojectname + "-" + branchname + " lbs-" + projectname
            shell.executeshell(cmd)
        elif userconfig['GitType'] == 'gitlab':
            cmd = "cd " + pathSrc + ";"
            cmd += "tar xzf " + branchname + ".tar.gz; mv lbs-" + gitprojectname + "-" + branchname + "-* lbs-" + projectname
            shell.executeshell(cmd)

        if os.path.isfile(sourceFile):
            os.remove(sourceFile)
        if not os.path.isdir(pathSrc + 'lbs-' + projectname):
            raise Exception("Problem with cloning the git repo")

        self.StorePackageHashes(pathSrc + 'lbs-' + projectname, username,
                                projectname, branchname)
Beispiel #27
0
 def __init__(self, file_queue):
     self.file_queue = file_queue
     self.shell = Shell()
Beispiel #28
0
def allowed_traffic_generate(name):
    print(str(name) + ' Thread starts')
    shell = Shell()
    while True:
        shell.execute("echo \"abcd\" | sudo -S curl http://172.24.4.159:8080")
        time.sleep(1)
Beispiel #29
0
 def set_shell_items(self, window):
     self.shell = Shell(window)
Beispiel #30
0
 def __init__(self, queue, dfQueue):
     self.df_queue = dfQueue
     self.queue = queue
     self.shell = Shell()