mirror of
https://github.com/cliffe/SecGen.git
synced 2026-02-21 11:18:06 +00:00
Merge branch 'master' of https://github.com/cliffe/SecGen
This commit is contained in:
@@ -149,11 +149,11 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>10</output_matches>
|
||||
<mesage>Something was not quite right with your private key file</mesage>
|
||||
<message>Something was not quite right with your private key file</message>
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>01</output_matches>
|
||||
<mesage>Something was not quite right with your public key file</mesage>
|
||||
<message>Something was not quite right with your public key file</message>
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>00</output_matches>
|
||||
@@ -211,7 +211,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>ok</output_matches>
|
||||
<mesage>ok... your turn.</mesage>
|
||||
<message>ok... your turn.</message>
|
||||
<trigger_quiz/>
|
||||
</condition>
|
||||
<else_condition>
|
||||
@@ -242,7 +242,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>ok</output_matches>
|
||||
<mesage>ok... your turn.</mesage>
|
||||
<message>ok... your turn.</message>
|
||||
<trigger_quiz/>
|
||||
</condition>
|
||||
<else_condition>
|
||||
@@ -271,7 +271,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>ok</output_matches>
|
||||
<mesage>ok... your turn.</mesage>
|
||||
<message>ok... your turn.</message>
|
||||
<trigger_quiz/>
|
||||
</condition>
|
||||
<else_condition>
|
||||
@@ -298,7 +298,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>ok</output_matches>
|
||||
<mesage>ok... your turn.</mesage>
|
||||
<message>ok... your turn.</message>
|
||||
<trigger_quiz/>
|
||||
</condition>
|
||||
<else_condition>
|
||||
@@ -326,7 +326,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>ok</output_matches>
|
||||
<mesage>ok... your turn.</mesage>
|
||||
<message>ok... your turn.</message>
|
||||
<trigger_quiz/>
|
||||
</condition>
|
||||
<else_condition>
|
||||
@@ -353,7 +353,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>ok</output_matches>
|
||||
<mesage>ok... your turn.</mesage>
|
||||
<message>ok... your turn.</message>
|
||||
<trigger_quiz/>
|
||||
</condition>
|
||||
<else_condition>
|
||||
@@ -381,7 +381,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>ok</output_matches>
|
||||
<mesage>ok... your turn.</mesage>
|
||||
<message>ok... your turn.</message>
|
||||
<trigger_quiz/>
|
||||
</condition>
|
||||
<else_condition>
|
||||
@@ -408,7 +408,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>ok</output_matches>
|
||||
<mesage>ok... your turn.</mesage>
|
||||
<message>ok... your turn.</message>
|
||||
<trigger_quiz/>
|
||||
</condition>
|
||||
<else_condition>
|
||||
@@ -437,7 +437,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>ok</output_matches>
|
||||
<mesage>ok... your turn.</mesage>
|
||||
<message>ok... your turn.</message>
|
||||
<trigger_quiz/>
|
||||
</condition>
|
||||
<else_condition>
|
||||
@@ -464,7 +464,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>ok</output_matches>
|
||||
<mesage>ok... your turn.</mesage>
|
||||
<message>ok... your turn.</message>
|
||||
<trigger_quiz/>
|
||||
</condition>
|
||||
<else_condition>
|
||||
|
||||
@@ -17,7 +17,9 @@ Open and read from the /etc/hosts file
|
||||
|
||||
```python3
|
||||
>>> with open("/etc/hosts", "rb") as f:
|
||||
>>> file = f.read()
|
||||
... file = f.read()
|
||||
...
|
||||
>>>
|
||||
```
|
||||
|
||||
You can generate random key using this command in a bash shell:
|
||||
@@ -39,6 +41,14 @@ You can inspect the contents of the ciphertext
|
||||
|
||||
`>>> print(c)`
|
||||
|
||||
To write data to a file, open the file in *w*rite *b*inary mode
|
||||
```python3
|
||||
>>> with open("/etc/hosts.enc", "wb") as f:
|
||||
... f.write(c)
|
||||
...
|
||||
>>>
|
||||
```
|
||||
|
||||
To decrypt...
|
||||
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>ok</output_matches>
|
||||
<mesage>ok... your turn.</mesage>
|
||||
<message>ok... your turn.</message>
|
||||
<trigger_quiz/>
|
||||
</condition>
|
||||
<else_condition>
|
||||
@@ -229,7 +229,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>ok</output_matches>
|
||||
<mesage>ok... your turn.</mesage>
|
||||
<message>ok... your turn.</message>
|
||||
<trigger_quiz/>
|
||||
</condition>
|
||||
<else_condition>
|
||||
@@ -247,7 +247,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
<attack>
|
||||
<!-- topic: Encrypt file with Python -->
|
||||
|
||||
<prompt>Using Python3 and Cryptodome with AES in ECB mode and the key b"<%= $enc_file_python_key %>" encrypt the file: <%= $file_to_encrypt_path %> and store the ciphertext at: <%= $enc_file_stu_ct_path %></prompt>
|
||||
<prompt>Using Python3 and Cryptodome with AES in ECB mode and the key b"<%= $enc_file_python_key %>" encrypt the file: <%= $file_to_encrypt_path %> and write the ciphertext binary data to the file: <%= $enc_file_stu_ct_path %></prompt>
|
||||
<post_command>python3 -c 'from Cryptodome.Cipher import AES; from Cryptodome.Util.Padding import pad,unpad; student_ct_file = open("<%= $enc_file_stu_ct_path %>","rb"); student_ct = student_ct_file.read(); k = b"<%= $enc_file_python_key %>"; e = AES.new(k, AES.MODE_ECB); target_plaintext_file = open("<%= $file_to_encrypt_path %>", "rb"); target_plaintext = target_plaintext_file.read(); ct = e.encrypt(pad(target_plaintext,16)); print(ct == student_ct)'</post_command>
|
||||
<suppress_command_output_feedback/>
|
||||
<condition>
|
||||
@@ -256,7 +256,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
</condition>
|
||||
<condition>
|
||||
<output_matches>False</output_matches>
|
||||
<mesage>Something was not quite right... </mesage>
|
||||
<message>Something was not quite right... </message>
|
||||
</condition>
|
||||
<else_condition>
|
||||
<message>Something was not quite right...</message>
|
||||
@@ -278,7 +278,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
||||
<!-- </condition>-->
|
||||
<!-- <condition>-->
|
||||
<!-- <output_matches>ok</output_matches>-->
|
||||
<!-- <mesage>ok... your turn.</mesage>-->
|
||||
<!-- <message>ok... your turn.</message>-->
|
||||
<!-- <trigger_quiz/>-->
|
||||
<!-- </condition>-->
|
||||
<!-- <else_condition>-->
|
||||
|
||||
Reference in New Issue
Block a user