Skip to content

Commit

Permalink
Merge pull request #2 from frikky/master
Browse files Browse the repository at this point in the history
Getting new commits
  • Loading branch information
shalin24999 authored Mar 31, 2021
2 parents 157b580 + 4fca74b commit f3d0e50
Show file tree
Hide file tree
Showing 13 changed files with 881 additions and 120 deletions.
2 changes: 1 addition & 1 deletion Cylance/1.0.0/api.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
app_version: 1.0.0
name: Cylance
description: An app to handle Cylance. Awful authentication.
description: An app to handle Cylance.
contact_info:
name: "@frikkylikeme"
url: https://shuffler.io
Expand Down
38 changes: 38 additions & 0 deletions Docs/aws-iam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## AWS IAM App
Aws IAM (Identity and Access Management) app for managing IAM operations from the shuffle.

![alt_text](https://github.com/dhaval055/Shuffle-apps/blob/master/Docs/iam.png?raw=true)

## Actions

| No. | Action | Description | Parameters |
|-----|--------|-------------|------------|
|1 | Get user | Retrieves information about the specified IAM user, including the user's creation date, path, unique ID, and ARN | access_key, secret_key, region, user_name
|2 | Change password | Change password of the specified user | access_key, secret_key, region, username, password
|3 | List users | Lists the IAM users | access_key, secret_key, region, path_prefix, marker, max_items
|4 | List user tags | Lists the tags that are attached to the specified IAM user | access_key, secret_key, region, user_name, marker, max_items
|5 | List attached user policies | Lists all managed policies that are attached to the specified IAM user | access_key, secret_key, region, user_name, marker, max_items
|6 | Attach user policy | Attach policy to the user | access_key, secret_key, region, username, policy_arn
|7 | Get instance profile | Retrieves information about the specified instance profile, including the instance profile's path, GUID, ARN, and role. | access_key, secret_key, region, instance_profile_name
|8 | List access keys | List all access keys | access_key, secret_key, region, username, marker, max_items
|9 | List ssh public keys | List SSH public keys | access_key, secret_key, region, username, marker, max_items

__Note__: access_key, secret_key and region are used for authentication.

## Requirements

1. AWS account
2. Access key, Secret key and region of the user.

- __How to find access key & secret key ?__
1. Open https://console.aws.amazon.com/
2. From navbar click on user dropwodown → My Security Credentials.
3. Open the Access keys tab, and then choose Create access key.
4. To see the new access key, choose Show. Your credentials resemble the following:
- Access key ID: AKIAIOSFODNN7EXAMPLE
- Secret access key: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

## Note
Some actions have marker and max_items parameters (Both are used for paginating results).
- marker : Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the marker element in the response that you received to indicate where the next call should start.
- max_items : Use this only when paginating results to indicate the maximum number of items you want in the response.
Binary file added Docs/iam.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions Microsoft-Teams/1.0.0/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ actions:
example: 'Alert...'
schema:
type: string
- name: added_information
description: Some extra information to be added to the callback. E.g. an alert
required: true
multiline: true
example: '$new_ticket.ticket_id'
schema:
type: string
- name: callback_url
description: webhook url of your workflow in shuffle
required: true
Expand Down
32 changes: 28 additions & 4 deletions Microsoft-Teams/1.0.0/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,38 @@ async def send_rich_text(self, webhook_url, title, message, link_button_text, li

return f'Message Sent'

async def send_actionable_msg(self, webhook_url, title, message, callback_url):
async def send_actionable_msg(self, webhook_url, title, message, added_information, callback_url):
try:
myTeamsMessage = teams.connectorcard(webhook_url) # You must create the connectorcard object with the Microsoft Webhook URL
myTeamsMessage.title(title) # title for your card
myTeamsMessage.text(message) # Add text to the message.
myTeamsPotentialAction3 = teams.potentialaction(_name = "Select_Action")
myTeamsPotentialAction3.choices.addChoices("Accept","Accept") #option 1
myTeamsPotentialAction3.choices.addChoices("Reject","Reject") #option 2
myTeamsPotentialAction3.addInput("MultichoiceInput","list","Select Action",False) #Dropdown menu

value = {
"choice": "ACCEPT",
"extra": added_information,
}

#print(f"VALUE: {value}")

try:
accept = json.dumps(value)
except:
print("FAILED ENCODING ACCEPT")
accept = "ACCEPT"

myTeamsPotentialAction3.choices.addChoices("Accept", accept) #option 1

value["choice"] = "REJECT"
try:
deny = json.dumps(value)
except:
print("FAILED ENCODING REJECT")
deny = "REJECT"

myTeamsPotentialAction3.choices.addChoices("Reject", deny) #option 2

myTeamsPotentialAction3.addInput("MultichoiceInput","list","Select Action", False) #Dropdown menu
myTeamsPotentialAction3.addAction("HttpPost","Submit",callback_url) #post request to Shuffle
myTeamsMessage.addPotentialAction(myTeamsPotentialAction3)
myTeamsMessage.send()# send the message.
Expand All @@ -74,5 +97,6 @@ async def get_user_input(self, webhook_url, title, message, callback_url):
return f'{e.__class__} occured'

return f'Message Sent'

if __name__ == "__main__":
asyncio.run(MsTeams.run(), debug=True)
26 changes: 26 additions & 0 deletions aws-iam/1.0.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Base our app image off of the WALKOFF App SDK image
FROM frikky/shuffle:app_sdk as base

# We're going to stage away all of the bloat from the build tools so lets create a builder stage
FROM base as builder

# Install all alpine build tools needed for our pip installs
RUN apk --no-cache add --update alpine-sdk libffi libffi-dev musl-dev openssl-dev

# Install all of our pip packages in a single directory that we can copy to our base image later
RUN mkdir /install
WORKDIR /install
COPY requirements.txt /requirements.txt
RUN pip install --prefix="/install" -r /requirements.txt

# Switch back to our base image and copy in all of our built packages and source code
FROM base
COPY --from=builder /install /usr/local
COPY src /app

# Install any binary dependencies needed in our final image
# RUN apk --no-cache add --update my_binary_dependency

# Finally, lets run our app!
WORKDIR /app
CMD python app.py --log-level DEBUG
Loading

0 comments on commit f3d0e50

Please sign in to comment.