Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #42 from vidar-team/dev
Browse files Browse the repository at this point in the history
fix: use strings.Replace instead of AllReplace
  • Loading branch information
wuhan005 authored May 5, 2020
2 parents fe4c387 + c443ee5 commit a7fc00a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ func (s *Service) refreshFlag() {
Round: s.Timer.NowRound,
}).Find(&flag)
// Replace the flag placeholder.
command := strings.ReplaceAll(challenge.Command, "{{FLAG}}", flag.Flag)
// strings.ReplaceAll need Go 1.13+, so we use strings.Replace here.
command := strings.Replace(challenge.Command, "{{FLAG}}", flag.Flag, -1)
err := utils.SSHExecute(gamebox.IP, gamebox.SSHPort, gamebox.SSHUser, gamebox.SSHPassword, command)
if err != nil {
s.NewLog(IMPORTANT, "ssh_error", fmt.Sprintf("Team:%d Gamebox:%d Round:%d SSH 更新 Flag 失败:%v", gamebox.TeamID, gamebox.ID, s.Timer.NowRound, err.Error()))
Expand Down

0 comments on commit a7fc00a

Please sign in to comment.