Skip to content

Tags: facebookincubator/TTPForge

Tags

v1.2.1

Toggle v1.2.1's commit message
Drop non-unique Cleanup logic from expect step (#516)

Summary:
Pull Request resolved: #516

To enable actual clean ups and prevent errors like

```
ERROR   failed to run command:
        could not load TTP at /home/nesusvet/security-ttpcode/ttps/infra/tupperware/ssh-to-container-as-root.yaml:
        could not parse action for step "start-tupperware-container": action fields did not match any valid action type
```

Changes pretty radical but I don't see why we need a custom implementation of cleanup logic for expect step

Consider small change to the [expect.yaml](https://www.internalfb.com/code/fbsource/fbcode/security/redteam/purple_team/ttpforge/example-ttps/actions/expect/expect.yaml) example TTP
```
hg d
 diff --git a/fbcode/security/redteam/purple_team/ttpforge/example-ttps/actions/expect/expect.yaml b/fbcode/security/redteam/purple_team/ttpforge/example-ttps/actions/expect/expect.yaml
 --- a/fbcode/security/redteam/purple_team/ttpforge/example-ttps/actions/expect/expect.yaml
    b/fbcode/security/redteam/purple_team/ttpforge/example-ttps/actions/expect/expect.yaml
@@ -26,3  26,4 @@
           response: "John"
         - prompt: "Enter your age:"
           response: "30"
       cleanup: echo "Done"
```

Try to run it on master and see NO CLEANUP instructions executed:
```
 buck run security/redteam/purple_team/ttpforge:ttpforge -- run security/redteam/purple_team/ttpforge/example-ttps/actions/expect/expect.yaml
File changed: fbcode//security/redteam/purple_team/ttpforge/example-ttps/actions/expect/expect.yaml
Buck UI: https://www.internalfb.com/buck2/a008be5d-79d8-4591-960a-64fafbc10a44
Network: Up: 0B  Down: 0B
Jobs completed: 4. Time elapsed: 0.0s.
BUILD SUCCEEDED
INFO    RUNNING TTP: Complex Expect Step with Python Script
INFO    ----------------------------------------
INFO    Executing Step #1: "create_python_script"
INFO    ----------------------------------------
INFO    Executing Step #2: "run_expect_script"
Enter your name:
John
Enter your age:
30
Hello John, you are 30 years old!
INFO    ----------------------------------------
INFO    All TTP steps completed successfully!
INFO    ========================================
INFO    CLEANING UP 2 steps of TTP: "Complex Expect Step with Python Script"
INFO    ----------------------------------------
INFO    Cleaning Up Step #2: "run_expect_script"
INFO    No Cleanup Action Defined for Step run_expect_script
INFO    ----------------------------------------
INFO    Cleaning Up Step #1: "create_python_script"
INFO    No Cleanup Action Defined for Step create_python_script
INFO    ----------------------------------------
INFO    Finished Cleanup Successfully
```

Differential Revision: D64108097

fbshipit-source-id: 2ab395b393b88ebfd0f5dd647cd75f34fce52b97

v1.2.0

Toggle v1.2.0's commit message
Create all directories before creating a new file (#511)

Summary:
From the golang 1.23 os/file.go
```
// Flags to OpenFile wrapping those of the underlying system. Not all
// flags may be implemented on a given system.
const (
	// Exactly one of O_RDONLY, O_WRONLY, or O_RDWR must be specified.
	O_RDONLY int = syscall.O_RDONLY // open the file read-only.
	O_WRONLY int = syscall.O_WRONLY // open the file write-only.
	O_RDWR   int = syscall.O_RDWR   // open the file read-write.
	// The remaining values may be or'ed in to control behavior.
	O_APPEND int = syscall.O_APPEND // append data to the file when writing.
	O_CREATE int = syscall.O_CREAT  // create a new file if none exists.
	O_EXCL   int = syscall.O_EXCL   // used with O_CREATE, file must not exist.
	O_SYNC   int = syscall.O_SYNC   // open for synchronous I/O.
	O_TRUNC  int = syscall.O_TRUNC  // truncate regular writable file when opened.
)
```

Which makes me think that we might want to call MkdirAll function before creating a file

Pull Request resolved: #511

Resolves #506

Differential Revision: D61658174

fbshipit-source-id: b0352f44335f19773854170df787292676cf5a8e

v1.1.0

Toggle v1.1.0's commit message
Update goreleaser action (#508)

Summary:
Pull Request resolved: #508

Need to fix this error for new TTPForge release

 {F1798300338}

Reviewed By: d0n601

Differential Revision: D61042469

fbshipit-source-id: 5b76217b7b1db0ba73c5886e8024642bae336582

v1.0.12

Toggle v1.0.12's commit message
go.mod: remove unnecessary replace directive (#444)

Summary:
Pull Request resolved: #444

We don't need this anymore now that we have native buck build support

Reviewed By: yarikk

Differential Revision: D51498587

fbshipit-source-id: 00372af42a48624aef2c7e3b2ab3ed3deaaaaaa7

v1.0.11

Toggle v1.0.11's commit message
Documentation: Foundations (#443)

Summary:
Pull Request resolved: #443

* Add foundational feature documentation
* Revamp the README.md and Link it to Foundational Documentation
* Suggest looking at the rendered markdown in the Github pull request to review

Reviewed By: cedowens

Differential Revision: D51495585

fbshipit-source-id: 70b3e31ddeeea101f158663c80d9dc9047a32897

v1.0.10

Toggle v1.0.10's commit message
Args: Add `path` arg type to fix working directory handling (#442)

Summary:
Pull Request resolved: #442

* Add new argument type `path:`
* This makes relative paths work correctly when passed as arguments
* Previously, if you passed `--arg myarg=foo/bar` the behavior was busted because the TTP will change its working directory to the parent directory of the  TTP's YAML file, and `foo/bar` won't exist there, even if it existed in the directory from which you invoked ttpforge :(
* Updated all examples to use the new arguments

Reviewed By: d0n601

Differential Revision: D51475492

fbshipit-source-id: 4dea0a1b0415ab39580ace902e3bd6e75aab315e

v1.0.9

Toggle v1.0.9's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Comprehensively Refactor Step Structure (#382)

* Simplify step creation by refactoring shared code and streamline unmarshalling
* Use the simplified setup to add new step types print_str and remove_path

v1.0.8

Toggle v1.0.8's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
add createfile step (#366)

v1.0.7

Toggle v1.0.7's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Repository Handling Updates: `install` and `remove` commands (#314)

* first draft of install command

* additional improvements to initialization for bundling compatibility

* remove unnecessary extra parameter in repo collection

* add appropriate absolute path handling to repo itself

* working repo removal command

* add test case to verify it all can work with no config file

* usage improvement, bugfix, add test case to ensure that everything works without config

* output formatting improvements and fixing pointer bugs

* appease pre-commit

* fix typo

* bugfix config compatibility with test cases

* fix spelling error

* remove underscores

* remove deprecated library usage

* remove additional underscore

v1.0.6

Toggle v1.0.6's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Fix Working Directory Handling Bug and Refactor Cobra for Testability (

…#301)

* Fix bug introduced during afero.Fs standardization
* Refactor cobra command setup to help future E2E test implementation