Best Python code snippet using tox_python
encrypt.py
Source: encrypt.py
1from Crypto.Cipher import AES2import base643import utils4EncodedPartnerToken = 'pOwEMHkILj263JJxU150TaY4WLSrZrOg/5461micp0UnbDsyCOORiXGMmJSWRuAvPf/M75sLIsfzhJaCTsCUeg=='5EncodedMerchantToken = 'dSiUYs/Kj0EehSSIjxsyf1TrwKoFJHVLC+NIF1KCf0MhuVGGryW9YtuI7vxTyX4FesbguyDe/KllkbQ0IYlrcA=='6EncodedFromMail = 'WCFemY/IjrBxC8z2QybSmIpT/hpJcLtvNZyMsTADxl4='7EncodedToMail = 'KPCxI6QmV0baUkuQtX9HICjwsSOkJldG2lJLkLV/RyDBXYGC+/5UJai7Tn2/hQM0ZFMW9Me6x5AzkssoXfWWpg=='8EncodedGoogleAPI = 'KPCxI6QmV0baUkuQtX9HIFh0QM5YjEVyk5CvFQjnnFjz8l2whqRYS4rs53Zqw3omNQOurWBJFpr3Ts5vpzt+dg=='9EncodedCheck = 'KPCxI6QmV0baUkuQtX9HICjwsSOkJldG2lJLkLV/RyAo8LEjpCZXRtpSS5C1f0cgzw9nbTcmxhRFVkCnILyKhg=='10passdict = utils.readJson('../password.json')11if passdict == {}:12 password = raw_input("Password:")13else:14 password = passdict['password']15#Used once for generating encoded key paste above16def makeKey(p,Key):17 msg = Key.rjust(64)18 cipher = AES.new(key=p.rjust(32))19 enc = cipher.encrypt(msg)20 #print(enc)21 #print(cypher.decrypt(enc))22 encoded = base64.b64encode(enc)23 return encoded24def getDecoded(encoded):25 cipher = AES.new(key=password.rjust(32))26 decoded = cipher.decrypt(base64.b64decode(encoded))27 return decoded28def getPartnerToken():29 return getDecoded(EncodedPartnerToken)30def getMerchantToken():31 return getDecoded(EncodedMerchantToken)32def getFromMail():33 return getDecoded(EncodedFromMail)34def getToMail():35 return getDecoded(EncodedToMail).strip()36def getGoogleAPI():37 return getDecoded(EncodedGoogleAPI).strip()38def getCheck():39 return getDecoded(EncodedCheck).strip()40def checkPassword(attempt):41 cipher = AES.new(key=attempt.rjust(32))42 decoded = cipher.decrypt(base64.b64decode(EncodedCheck))43 if decoded.strip() == 'CodeCracked!':44 return True45 else:...
highValueClient.py
Source: highValueClient.py
1import socket2"""3 Our simple client for higher values4 Copyright (C) 2014 Leon Schwalb and Fabian Stein5 6 This program is free software: you can redistribute it and/or modify7 it under the terms of the GNU General Public License as published by8 the Free Software Foundation, either version 3 of the License, or9 (at your option) any later version.10 11 This program is distributed in the hope that it will be useful,12 but WITHOUT ANY WARRANTY; without even the implied warranty of13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14 GNU General Public License for more details.15 16 You should have received a copy of the GNU General Public License17 along with this program. If not, see <http://www.gnu.org/licenses/>.18 """19def connect(host, port, message):20 21 finalString = " "22 23 connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)24 address = (host, port)25 26 connection.connect(address)27 28 connection.sendall(str.encode(message))29 while True:30 get = connection.recv(8192)31 getDecoded = get.decode("UTF-8")32 if getDecoded != "":33 getDecoded = str(getDecoded)34 print(getDecoded)35 else:36 break37 38 connection.close()39 ...
client.py
Source: client.py
1import socket2"""3Our simple client4Copyright (C) 2014 Leon Schwalb and Fabian Stein5This program is free software: you can redistribute it and/or modify6it under the terms of the GNU General Public License as published by7the Free Software Foundation, either version 3 of the License, or8(at your option) any later version.9This program is distributed in the hope that it will be useful,10but WITHOUT ANY WARRANTY; without even the implied warranty of11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12GNU General Public License for more details.13You should have received a copy of the GNU General Public License14along with this program. If not, see <http://www.gnu.org/licenses/>.15"""16def connect(host, port, message):17 18 finalString = ""19 20 connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)21 address = (host, port)22 23 connection.connect(address)24 25 connection.sendall(str.encode(message))26 while True:27 get = connection.recv(8192)28 getDecoded = get.decode("UTF-8")29 if getDecoded != "":30 getDecoded = str(getDecoded)31 finalString += finalString + getDecoded32 else:33 break34 35 connection.close()36 ...
Check out the latest blogs from LambdaTest on this topic:
Hey Testers! We know it’s been tough out there at this time when the pandemic is far from gone and remote working has become the new normal. Regardless of all the hurdles, we are continually working to bring more features on-board for a seamless cross-browser testing experience.
Manual cross browser testing is neither efficient nor scalable as it will take ages to test on all permutations & combinations of browsers, operating systems, and their versions. Like every developer, I have also gone through that ‘I can do it all phase’. But if you are stuck validating your code changes over hundreds of browsers and OS combinations then your release window is going to look even shorter than it already is. This is why automated browser testing can be pivotal for modern-day release cycles as it speeds up the entire process of cross browser compatibility.
With new-age project development methodologies like Agile and DevOps slowly replacing the old-age waterfall model, the demand for testing is increasing in the industry. Testers are now working together with the developers and automation testing is vastly replacing manual testing in many ways. If you are new to the domain of automation testing, the organization that just hired you, will expect you to be fast, think out of the box, and able to detect bugs or deliver solutions which no one thought of. But with just basic knowledge of testing, how can you be that successful test automation engineer who is different from their predecessors? What are the skills to become a successful automation tester in 2019? Let’s find out.
Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.
I routinely come across test strategy documents when working with customers. They are lengthy—100 pages or more—and packed with monotonous text that is routinely reused from one project to another. Yawn once more— the test halt and resume circumstances, the defect management procedure, entrance and exit criteria, unnecessary generic risks, and in fact, one often-used model replicates the requirements of textbook testing, from stress to systems integration.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!