Skip to content

Ftp c2#2211

Merged
wbooth merged 30 commits into
masterfrom
ftp-c2
Aug 19, 2021
Merged

Ftp c2#2211
wbooth merged 30 commits into
masterfrom
ftp-c2

Conversation

@Sloane4
Copy link
Copy Markdown
Contributor

@Sloane4 Sloane4 commented Aug 3, 2021

Description

Contact_ftp.py file to handle communication between CALDERA server and agent. Requierments.txt and conf/default.yml have been updated with relevant values. The ftp.py and ftp.go files will be added in a later pull request. The default.yml contains two directory values for ftp. The ftp.server.dir value is were the files that the agent generates during ftp c2 are stored (under their paw directory). For example if ftp.server.dir: /tmp/caldera, the files are stored under /caldera/tmp/caldera/paw.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Some pytesting has occurred (Not satisfactory, backlogged). Beaconing, uploading files, and downloading payloads has been tested with a sandcat agent on Linux and Windows 10 vms. Multiple agents can communicate at the same time.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

@Sloane4 Sloane4 requested a review from uruwhy August 3, 2021 16:15
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wohoo! Your first PR -- thanks for contributing!

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 6, 2021

Codecov Report

Merging #2211 (9f20a02) into master (41e8c4e) will decrease coverage by 0.38%.
The diff coverage is 50.95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2211      +/-   ##
==========================================
- Coverage   68.10%   67.72%   -0.39%     
==========================================
  Files          89       90       +1     
  Lines        6801     6958     +157     
==========================================
+ Hits         4632     4712      +80     
- Misses       2169     2246      +77     
Impacted Files Coverage Δ
app/contacts/contact_ftp.py 50.95% <50.95%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 41e8c4e...9f20a02. Read the comment docs.

Copy link
Copy Markdown
Contributor

@uruwhy uruwhy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Left some comments for organization and clarity on variable/function names. I do have one other request - could you provide more detail on the created directories, either in the PR description or somewhere in code comments? That way folks using or digging into the C2 have an idea on the directory structure, where files will end up on disk, etc

Comment thread requirements.txt Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
@Sloane4 Sloane4 requested a review from uruwhy August 11, 2021 18:21
Copy link
Copy Markdown
Contributor

@uruwhy uruwhy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Few more small changes here and there

Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Copy link
Copy Markdown
Contributor

@uruwhy uruwhy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more comments, plus the discussion about cwd + self.directory

@Sloane4 Sloane4 requested a review from uruwhy August 12, 2021 18:07
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Aug 13, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

Comment thread tests/contacts/test_contact_ftp.py Outdated
Comment thread conf/default.yml Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py
Copy link
Copy Markdown
Contributor

@uruwhy uruwhy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more changes - clearer variable names, and turning duplicate code into a helper function. Looking great, and it's almost there!

@Sloane4 Sloane4 requested a review from uruwhy August 17, 2021 17:58
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
@Sloane4 Sloane4 requested a review from uruwhy August 18, 2021 15:53
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Copy link
Copy Markdown
Contributor

@uruwhy uruwhy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there!

uruwhy
uruwhy previously approved these changes Aug 18, 2021
Copy link
Copy Markdown
Contributor

@uruwhy uruwhy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@uruwhy uruwhy requested a review from wbooth August 18, 2021 19:51
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread app/contacts/contact_ftp.py Outdated
Comment thread conf/default.yml
Copy link
Copy Markdown
Contributor

@uruwhy uruwhy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wbooth wbooth merged commit 27115a3 into master Aug 19, 2021
@wbooth wbooth deleted the ftp-c2 branch August 19, 2021 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants