-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring
More file actions
86 lines (60 loc) · 1.81 KB
/
Copy pathstring
File metadata and controls
86 lines (60 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
2018/03/20
字串(string)資料型態及其運算
string1 = "I love you"
---------replace()取代--------------
string1.replace("love","hate")
---------join()--------------
'_'.join("Dragon")
'x'.join("Dragon")
-------split()---------------
string1.split()
#string2 = 'x'.join("Dragon")
#string2.split(sep='x')
string1.upper()
string1.swapcase()
###有空白==>去除空白#############
string11 = " I love you "
string11.strip()
---擴充版凱薩加密及暴力破解----------------------------------------------------------
#!/usr/bin/env python3
alpha = 'abcdefghijklmnopqrstuvwxyz'
num = '0123456789'
alnum = alpha + num
ctext = '7sj-ighm-742q3w4t'
def rotate(s, num):
new1 = ''
for c in s:
if c in alnum:
new1 += alnum[(alnum.index(c) + num) % 36]
else:
new1 += c
return new1
for x in range(36):
print("{}".format(rotate(ctext, x)))
====================
#!/usr/bin/env python3
import string
alphabet = string.ascii_lowercase + string.ascii_uppercase + string.digits
ctext = "7sj-ighm-742q3w4t"
def shift(n):
message = ""
for index, char in enumerate(ctext):
if char == "-":
message += char
else:
message += alphabet[(alphabet.index(ctext[index])+n)%len(alphabet)]
return message.upper()
for i in range(len(alphabet)):
message = shift(i)
if "RC3" in message:
print(message)
------------------------------------------------------------------
a='cvqAeqacLtqazEigwiXobxrCrtuiTzahfFreqc{bnjrKwgk83kgd43j85ePgb_e_rwqr7fvbmHjklo3tews_hmkogooyf0vbnk0ii87Drfgh_n kiwutfb0ghk9ro987k5tfb_hjiouo087ptfcv}'
a=a[3:]
flag = ''
for x in range(0,len(a),1):
if x%5==0:
flag+=a[x]
print flag
------------------------------------------------------------------
re模組與正規表達法(NeXT)