mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
update Fabric models, add new sink to Fabric, add proper test cases
This commit is contained in:
@@ -5,7 +5,6 @@ Loosely inspired by http://docs.fabfile.org/en/2.5/getting-started.html
|
||||
|
||||
from fabric import connection, Connection, group, SerialGroup, ThreadingGroup, tasks, task
|
||||
|
||||
|
||||
################################################################################
|
||||
# Connection
|
||||
################################################################################
|
||||
@@ -22,6 +21,32 @@ c.sudo(command="cmd1; cmd2") # $getCommand="cmd1; cmd2"
|
||||
c2 = connection.Connection("web2")
|
||||
c2.run("cmd1; cmd2") # $getCommand="cmd1; cmd2"
|
||||
|
||||
# ssh proxy_command command injection with gateway parameter,
|
||||
# we need to call some of the following functions to run the proxy command
|
||||
c = Connection("web1", gateway="cmd") # $getCommand="cmd"
|
||||
c.run(command="cmd1; cmd2") # $getCommand="cmd1; cmd2"
|
||||
c = Connection("web1", gateway="cmd") # $getCommand="cmd"
|
||||
c.get("afs")
|
||||
c = Connection("web1", gateway="cmd") # $getCommand="cmd"
|
||||
c.sudo(command="cmd1; cmd2") # $getCommand="cmd1; cmd2"
|
||||
c = Connection("web1", gateway="cmd") # $getCommand="cmd"
|
||||
c.open_gateway()
|
||||
c = Connection("web1", gateway="cmd") # $getCommand="cmd"
|
||||
c.open()
|
||||
c = Connection("web1", gateway="cmd") # $getCommand="cmd"
|
||||
c.create_session()
|
||||
c = Connection("web1", gateway="cmd") # $getCommand="cmd"
|
||||
c.forward_local("80")
|
||||
c = Connection("web1", gateway="cmd") # $getCommand="cmd"
|
||||
c.forward_remote("80")
|
||||
c = Connection("web1", gateway="cmd") # $getCommand="cmd"
|
||||
c.put(local="local")
|
||||
c = Connection("web1", gateway="cmd") # $getCommand="cmd"
|
||||
c.shell()
|
||||
c = Connection("web1", gateway="cmd") # $getCommand="cmd"
|
||||
c.sftp()
|
||||
# no call to desired methods so it is safe
|
||||
c = Connection("web1", gateway="cmd")
|
||||
|
||||
################################################################################
|
||||
# SerialGroup
|
||||
@@ -30,11 +55,11 @@ results = SerialGroup("web1", "web2", "mac1").run("cmd1; cmd2") # $getCommand="
|
||||
|
||||
pool = SerialGroup("web1", "web2", "web3")
|
||||
pool.run("cmd1; cmd2") # $getCommand="cmd1; cmd2"
|
||||
pool.sudo("cmd1; cmd2") # $getCommand="cmd1; cmd2"
|
||||
|
||||
# fully qualified usage
|
||||
group.SerialGroup("web1", "web2", "mac1").run("cmd1; cmd2") # $getCommand="cmd1; cmd2"
|
||||
|
||||
|
||||
################################################################################
|
||||
# ThreadingGroup
|
||||
################################################################################
|
||||
@@ -42,6 +67,7 @@ results = ThreadingGroup("web1", "web2", "mac1").run("cmd1; cmd2") # $getComman
|
||||
|
||||
pool = ThreadingGroup("web1", "web2", "web3")
|
||||
pool.run("cmd1; cmd2") # $getCommand="cmd1; cmd2"
|
||||
pool.sudo("cmd1; cmd2") # $getCommand="cmd1; cmd2"
|
||||
|
||||
# fully qualified usage
|
||||
group.ThreadingGroup("web1", "web2", "mac1").run("cmd1; cmd2") # $getCommand="cmd1; cmd2"
|
||||
@@ -57,6 +83,7 @@ def foo(c):
|
||||
# 'c' is a fabric.connection.Connection
|
||||
c.run("cmd1; cmd2") # $getCommand="cmd1; cmd2"
|
||||
|
||||
|
||||
# fully qualified usage
|
||||
@tasks.task
|
||||
def bar(c):
|
||||
|
||||
Reference in New Issue
Block a user