forked from EmpireProject/Empire
-
-
Notifications
You must be signed in to change notification settings - Fork 584
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add starkiller config properties and a sync command * move the starkiller sync to its own script * refactor * revert db password * update test server config
- Loading branch information
Showing
8 changed files
with
126 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import logging | ||
import os | ||
import subprocess | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
def sync_starkiller(empire_config): | ||
""" | ||
Syncs the starkiller submodule with what is in the config. | ||
Using dict acccess because this script should be able to run with minimal packages, not just within empire. | ||
""" | ||
starkiller_config = empire_config["starkiller"] | ||
starkiller_submodule_dir = "empire/server/api/v2/starkiller" | ||
starkiller_temp_dir = "empire/server/api/v2/starkiller-temp" | ||
|
||
subprocess.run(["git", "submodule", "update", "--init", "--recursive"], check=True) | ||
|
||
if not starkiller_config["use_temp_dir"]: | ||
log.info("Syncing starkiller submodule to match config.yaml") | ||
subprocess.run( | ||
[ | ||
"git", | ||
"submodule", | ||
"set-url", | ||
"--", | ||
starkiller_submodule_dir, | ||
starkiller_config["repo"], | ||
], | ||
check=True, | ||
) | ||
subprocess.run( | ||
["git", "submodule", "sync", "--", starkiller_submodule_dir], check=True | ||
) | ||
|
||
subprocess.run(["git", "fetch"], cwd=starkiller_submodule_dir, check=True) | ||
subprocess.run( | ||
["git", "checkout", starkiller_config["ref"]], | ||
cwd=starkiller_submodule_dir, | ||
check=True, | ||
) | ||
|
||
else: | ||
if not os.path.exists(starkiller_temp_dir): | ||
log.info("Cloning starkiller to temp dir") | ||
subprocess.run( | ||
["git", "clone", starkiller_config["repo"], starkiller_temp_dir], | ||
check=True, | ||
) | ||
|
||
else: | ||
log.info("Updating starkiller temp dir") | ||
subprocess.run( | ||
["git", "remote", "set-url", "origin", starkiller_config["repo"]], | ||
cwd=starkiller_temp_dir, | ||
check=True, | ||
) | ||
|
||
subprocess.run(["git", "fetch"], cwd=starkiller_temp_dir, check=True) | ||
subprocess.run( | ||
["git", "checkout", starkiller_config["ref"]], | ||
cwd=starkiller_temp_dir, | ||
check=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,15 @@ database: | |
# an IP black list to reject accept clients from | ||
# format is "192.168.1.1,192.168.1.10-192.168.1.100,10.0.0.0/8" | ||
ip-blacklist: "" | ||
starkiller: | ||
repo: [email protected]:BC-SECURITY/Starkiller-Sponsors.git | ||
# Can be a branch, tag, or commit hash | ||
ref: 5.0-dev-sponsors | ||
# for private-main, instead of updating the submodule, just work out of a local copy. | ||
# So devs can work off the latest changes and not worry about accidentally updating the submodule | ||
# for the downstream main branches. | ||
use_temp_dir: false | ||
auto_update: true | ||
plugins: | ||
# Auto-load plugin with defined settings | ||
csharpserver: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,15 @@ database: | |
# an IP black list to reject accept clients from | ||
# format is "192.168.1.1,192.168.1.10-192.168.1.100,10.0.0.0/8" | ||
ip-blacklist: "" | ||
starkiller: | ||
repo: [email protected]:BC-SECURITY/Starkiller-Sponsors.git | ||
# Can be a branch, tag, or commit hash | ||
ref: 5.0-dev-sponsors | ||
# for private-main, instead of updating the submodule, just work out of a local copy. | ||
# So devs can work off the latest changes and not worry about accidentally updating the submodule | ||
# for the downstream main branches. | ||
use_temp_dir: false | ||
auto_update: true | ||
directories: | ||
downloads: empire/test/downloads/ | ||
module_source: empire/server/data/module_source/ | ||
|