mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
Make kcpassword works with Python 3 (#5234)
This commit is contained in:
@@ -27,13 +27,13 @@ def kcpassword(passwd):
|
|||||||
passwd[j] = passwd[j] ^ key[ki]
|
passwd[j] = passwd[j] ^ key[ki]
|
||||||
ki += 1
|
ki += 1
|
||||||
|
|
||||||
passwd = [chr(x) for x in passwd]
|
return bytearray(passwd)
|
||||||
return "".join(passwd)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
passwd = kcpassword(sys.argv[1])
|
passwd = kcpassword(sys.argv[1])
|
||||||
fd = os.open('/etc/kcpassword', os.O_WRONLY | os.O_CREAT, 0o600)
|
fd = os.open('/etc/kcpassword', os.O_WRONLY | os.O_CREAT, 0o600)
|
||||||
file = os.fdopen(fd, 'w')
|
file = os.fdopen(fd, 'wb')
|
||||||
|
file.truncate(0)
|
||||||
file.write(passwd)
|
file.write(passwd)
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user