From 02400c725a2699835be0fe885c3851e113c1f8c9 Mon Sep 17 00:00:00 2001 From: ivuorinen Date: Fri, 1 Nov 2024 00:19:20 +0000 Subject: [PATCH] Update cheatsheets --- tldr/linux/ip-route-get | 33 +++++++++++++++++++++++++++++++++ tldr/npm-audit | 38 ++++++++++++++++++++++++++++++++++++++ tldr/npm-find-dupes | 41 +++++++++++++++++++++++++++++++++++++++++ tldr/npm-init | 21 +++++++++++++++++++++ tldr/nxc-wmi | 25 +++++++++++++++++++++++++ tldr/pulumi-stack | 6 +++++- tldr/sui | 29 +++++++++++++++++++++++++++++ tldr/sui-client | 41 +++++++++++++++++++++++++++++++++++++++++ tldr/sui-client-faucet | 21 +++++++++++++++++++++ tldr/sui-client-ptb | 29 +++++++++++++++++++++++++++++ tldr/sui-move | 37 +++++++++++++++++++++++++++++++++++++ 11 files changed, 320 insertions(+), 1 deletion(-) create mode 100644 tldr/linux/ip-route-get create mode 100644 tldr/npm-audit create mode 100644 tldr/npm-find-dupes create mode 100644 tldr/npm-init create mode 100644 tldr/nxc-wmi create mode 100644 tldr/sui create mode 100644 tldr/sui-client create mode 100644 tldr/sui-client-faucet create mode 100644 tldr/sui-client-ptb create mode 100644 tldr/sui-move diff --git a/tldr/linux/ip-route-get b/tldr/linux/ip-route-get new file mode 100644 index 00000000..bd974d15 --- /dev/null +++ b/tldr/linux/ip-route-get @@ -0,0 +1,33 @@ +--- +syntax: markdown +tags: [tldr, linux] +source: https://github.com/tldr-pages/tldr.git +--- +# ip route get + +> Get a single route to a destination and print its contents exactly as the kernel sees it. +> More information: . + +- Print route to a destination: + +`ip route get {{1.1.1.1}}` + +- Print route to a destination from a specific source address: + +`ip route get {{destination}} from {{source}}` + +- Print route to a destination for packets arriving on a specific interface: + +`ip route get {{destination}} iif {{eth0}}` + +- Print route to a destination, forcing output through a specific interface: + +`ip route get {{destination}} oif {{eth1}}` + +- Print route to a destination with a specified Type of Service (ToS): + +`ip route get {{destination}} tos {{0x10}}` + +- Print route to a destination using a specific VRF (Virtual Routing and Forwarding) instance: + +`ip route get {{destination}} vrf {{myvrf}}` diff --git a/tldr/npm-audit b/tldr/npm-audit new file mode 100644 index 00000000..7cdc195e --- /dev/null +++ b/tldr/npm-audit @@ -0,0 +1,38 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# npm audit + +> Scan for known vulnerabilities in project dependencies. +> Reports vulnerabilities and suggests remediation. +> More information: . + +- Scan the project’s dependencies for known vulnerabilities: + +`npm audit` + +- Automatically fix vulnerabilities in the project's dependencies: + +`npm audit fix` + +- Force an automatic fix to dependencies with vulnerabilities: + +`npm audit fix {{-f|--force}}` + +- Update the lock file without modifying the `node_modules` directory: + +`npm audit fix --package-lock-only` + +- Perform a dry run. Simulate the fix process without making any changes: + +`npm audit fix --dry-run` + +- Output audit results in JSON format: + +`npm audit --json` + +- Configure the audit to only fail on vulnerabilities above a specified severity: + +`npm audit --audit-level={{info|low|moderate|high|critical}}` diff --git a/tldr/npm-find-dupes b/tldr/npm-find-dupes new file mode 100644 index 00000000..f9dd1388 --- /dev/null +++ b/tldr/npm-find-dupes @@ -0,0 +1,41 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# npm find-dupes + +> Identify duplicate dependencies in `node_modules`. +> More information: . + +- List all duplicate packages within `node_modules`: + +`npm find-dupes` + +- Include `devDependencies` in duplicate detection: + +`npm find-dupes --include=dev` + +- List all duplicate instances of a specific package in `node-modules`: + +`npm find-dupes {{package_name}}` + +- Exclude optional dependencies from duplicate detection: + +`npm find-dupes --omit=optional` + +- Set the logging level for output: + +`npm find-dupes --loglevel={{silent|error|warn|info|verbose}}` + +- Output duplicate information in JSON format: + +`npm find-dupes --json` + +- Limit duplicate search to specific scopes: + +`npm find-dupes --scope={{@scope1,@scope2}}` + +- Exclude specific scopes from duplicate detection: + +`npm find-dupes --omit-scope={{@scope1,@scope2}}` diff --git a/tldr/npm-init b/tldr/npm-init new file mode 100644 index 00000000..ba954fcc --- /dev/null +++ b/tldr/npm-init @@ -0,0 +1,21 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# npm init + +> Create a `package.json` file. +> More information: . + +- Initialize a new package with prompts: + +`npm init` + +- Initialize a new package with default values: + +`npm init -y` + +- Initialize a new package using a specific initializer: + +`npm init {{create-react-app}} {{my-app}}` diff --git a/tldr/nxc-wmi b/tldr/nxc-wmi new file mode 100644 index 00000000..c6c27289 --- /dev/null +++ b/tldr/nxc-wmi @@ -0,0 +1,25 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# nxc wmi + +> Pentest and exploit the Windows Management Instrumentation (WMI). +> More information: . + +- Search for valid credentials by trying out every combination in the specified lists of [u]sernames and [p]asswords: + +`nxc wmi {{192.168.178.2}} -u {{path/to/usernames.txt}} -p {{path/to/passwords.txt}}` + +- Authenticate via local authentication (as opposed to authenticating to the domain): + +`nxc wmi {{192.168.178.2}} -u {{username}} -p {{password}} --local-auth` + +- Issue the specified WMI query: + +`nxc wmi {{192.168.178.2}} -u {{username}} -p {{password}} --wmi {{wmi_query}}` + +- Execute the specified command on the targeted host: + +`nxc wmi {{192.168.178.2}} -u {{username}} -p {{password}} --x {{command}}` diff --git a/tldr/pulumi-stack b/tldr/pulumi-stack index 838424a3..f92e53b5 100644 --- a/tldr/pulumi-stack +++ b/tldr/pulumi-stack @@ -16,10 +16,14 @@ source: https://github.com/tldr-pages/tldr.git `pulumi stack` -- List known stacks: +- List stacks in the current project: `pulumi stack ls` +- List stacks across all projects: + +`pulumi stack ls --all` + - Select an active stack: `pulumi stack select {{stack_name}}` diff --git a/tldr/sui b/tldr/sui new file mode 100644 index 00000000..bc5ce8cf --- /dev/null +++ b/tldr/sui @@ -0,0 +1,29 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# sui + +> Interact with the Sui network. +> More information: . + +- Execute a Sui subcommand: + +`sui {{subcommand}}` + +- Build tools for a smart contract: + +`sui move {{subcommand}}` + +- Publish smart contracts, get object information, execute transactions and more: + +`sui client {{subcommand}}` + +- Start a local network: + +`sui start` + +- Update from source: + +`cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet sui` diff --git a/tldr/sui-client b/tldr/sui-client new file mode 100644 index 00000000..71a8de0d --- /dev/null +++ b/tldr/sui-client @@ -0,0 +1,41 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# sui client + +> Publish smart contracts, get object information, execute transactions, and more. +> More information: . + +- Create a new address with the ED25519 scheme: + +`sui client new-address ed25519 {{address-alias}}` + +- Create a new testnet environment with an RPC URL and alias: + +`sui client new-env --rpc https://fullnode.testnet.sui.io:443 --alias testnet` + +- Switch to the address of your choice (accepts also an alias): + +`sui client switch --address {{address-alias}}` + +- Switch to the given environment: + +`sui client switch --env {{env-alias}}` + +- Publish a smart contract: + +`sui client publish {{package-path}}` + +- Interact with the Sui faucet: + +`sui client faucet {{subcommand}}` + +- List the gas coins for the given address (accepts also an alias): + +`sui client gas {{address}}` + +- Create, sign, and execute programmable transaction blocks: + +`sui client ptb {{options}} {{subcommand}}` diff --git a/tldr/sui-client-faucet b/tldr/sui-client-faucet new file mode 100644 index 00000000..e731c00d --- /dev/null +++ b/tldr/sui-client-faucet @@ -0,0 +1,21 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# sui client faucet + +> Interact with the Sui faucet. +> More information: . + +- Get a SUI coin from the faucet associated with the active network: + +`sui client faucet` + +- Get a SUI coin for the address (accepts also an alias): + +`sui client faucet --address {{address}}` + +- Get a SUI coin from custom faucet: + +`sui client faucet --url {{custom-faucet-url}}` diff --git a/tldr/sui-client-ptb b/tldr/sui-client-ptb new file mode 100644 index 00000000..62ba6985 --- /dev/null +++ b/tldr/sui-client-ptb @@ -0,0 +1,29 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# sui client ptb + +> Create, sign and execute programmable transaction blocks. +> More information: . + +- Call a Move function from a package and module: + +`sui client ptb --move-call p::m::f "<{{type}}>" args` + +- Make a Move vector with two elements of type u64: + +`sui client ptb --make-move-vec "" "[1000,2000]"` + +- Split a gas coin and transfer it to address: + +`sui client ptb --split-coins gas "[1000]" --assign new_coins --transfer-objects "[new_coins]" @{{address}}` + +- Transfer an object to an address: + +`sui client ptb --transfer-objects "[{{object_id}}]" @{{address}}` + +- Publish a Move package, and transfer the upgrade capability to sender: + +`sui client ptb --move-call sui::tx_context::sender --assign sender --publish "." --assign upgrade_cap --transfer-objects "[upgrade_cap]" sender` diff --git a/tldr/sui-move b/tldr/sui-move new file mode 100644 index 00000000..024056de --- /dev/null +++ b/tldr/sui-move @@ -0,0 +1,37 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# sui move + +> Work with Move source code. +> More information: . + +- Create a new Move project in the given folder: + +`sui move new {{project_name}}` + +- Test the Move project in the current directory: + +`sui move test` + +- Test with coverage and get a summary: + +`sui move test --coverage; sui move coverage summary` + +- Find which parts of your code are covered from tests (i.e. explain coverage results): + +`sui move coverage source --module {{module_name}}` + +- Build the Move project in the current directory: + +`sui move build` + +- Build the Move project from the given path: + +`sui move build --path {{path}}` + +- Migrate to Move 2024 for the package at the provided path: + +`sui move migrate {{path}}`