Skip to content

improve the docs for the rsa and factor commands #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,13 @@ create a dockerfile from a template with ret
$ ret factor [--n]
```

factor with ret
arguments can be supplied as either base 10 or base 16 strings and the base will be inferred automatically
factor integers with ret

values can be supplied as either base 10 or base 16 strings and the base will be inferred automatically

for example FEED01234 will be treated as a base 16 string and 123456789 will be treated as a base 10 string

you can supply arguments the most common prefixes i.e. n= -n= --n=
you can supply values the most common prefixes i.e. n= -n= --n=

multiple values can be supplied as a list or with multiple argument prefixes e.g. -n=1,2,3 or -n=1 -n=2 -n=3

Expand All @@ -294,7 +295,6 @@ $ ret factor -n=0x591ccab6e6a72f019cf942f99f09
$ ret factor -n=147879229115615272273161474028448405953
```


🔗 https://github.com/rerrorctf/ret/blob/main/commands/factor.go

---
Expand Down Expand Up @@ -422,7 +422,6 @@ $ ret rsa -n=0x591ccab6e6a72f019cf942f99f09 -e=0x10001 -c=0x4a213f10d6c08b78ff5c
$ ret rsa -n=147879229115615272273161474028448405953 -e=3 -c=11160123069268350498833916853402276143
```


🔗 https://github.com/rerrorctf/ret/blob/main/commands/rsa.go

---
Expand Down
11 changes: 6 additions & 5 deletions commands/factor.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ func init() {
Optional: true,
List: false,
},
}})
},
SeeAlso: []string{"rsa", "crypto"}})
}

func FactorHelp() string {
return "factor with ret\n" +
return "factor integers with ret\n\n" +

"arguments can be supplied as either base 10 or base 16 strings and the base will be inferred automatically\n\n" +
"values can be supplied as either base 10 or base 16 strings and the base will be inferred automatically\n\n" +
"for example " + theme.ColorPurple + "FEED01234" + theme.ColorReset + " will be treated as a base 16 string and " + theme.ColorPurple + "123456789" + theme.ColorReset + " will be treated as a base 10 string\n\n" +
"you can supply arguments the most common prefixes i.e. " + theme.ColorBlue + "n= -n= --n= " + theme.ColorReset + "\n\n" +
"you can supply values the most common prefixes i.e. " + theme.ColorBlue + "n= -n= --n= " + theme.ColorReset + "\n\n" +
"multiple values can be supplied as a list or with multiple argument prefixes e.g. " + theme.ColorBlue + "-n=1,2,3 or -n=1 -n=2 -n=3" + theme.ColorReset + "\n\n" +

"this command opportunistically makes use of the following tools to perform factorization:\n\n" +
Expand All @@ -47,7 +48,7 @@ func FactorHelp() string {
theme.ColorGray + "$ " + theme.ColorBlue + "ret factor -n=1807415580361109435231633835400969\n" + theme.ColorReset +
theme.ColorGray + "$ " + theme.ColorBlue + "ret factor -n=0x591ccab6e6a72f019cf942f99f09\n" + theme.ColorReset +
theme.ColorGray + "$ " + theme.ColorBlue + "ret factor -n=147879229115615272273161474028448405953\n" + theme.ColorReset +
"```\n\n"
"```\n"
}

func parseFactorArgs(args []string) {
Expand Down
5 changes: 3 additions & 2 deletions commands/rsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ func init() {
Optional: true,
List: false,
},
}})
},
SeeAlso: []string{"factor", "crypto"}})
}

func RsaHelp() string {
Expand All @@ -71,7 +72,7 @@ func RsaHelp() string {
theme.ColorGray + "$ " + theme.ColorBlue + "ret rsa -n=1807415580361109435231633835400969 -e=65537 -c=1503532357945764445345675481376484\n" + theme.ColorReset +
theme.ColorGray + "$ " + theme.ColorBlue + "ret rsa -n=0x591ccab6e6a72f019cf942f99f09 -e=0x10001 -c=0x4a213f10d6c08b78ff5c0562e6e4\n" + theme.ColorReset +
theme.ColorGray + "$ " + theme.ColorBlue + "ret rsa -n=147879229115615272273161474028448405953 -e=3 -c=11160123069268350498833916853402276143\n" + theme.ColorReset +
"```\n\n"
"```\n"
}

func parseRsaArgs(args []string) {
Expand Down