INNER CODE UNIT · TypeScript
main
KishanBagaria/padding-oracle-attacker · src/cli.ts:124
async function main() {
const [operation, url] = argv._
const [,, thirdArg, fourthArg, paddingError] = argv._ as string[] | number[]
if (version) {
console.log(PKG_NAME, 'v' + PKG_VERSION)
return
}
const isEncrypt = operation === 'encrypt'
const isDecrypt = operation === 'decrypt'
const isAnalyze = ['analyze', 'analyse'].includes(operation)
const blockSize = Math.abs(isAnalyze ? +thirdArg : +fourthArg) || DEFAULT_BLOCK_SIZE
const requestOptions = { method, headers, data }
const cipherOrPlaintext = String(thirdArg)
if (
(!isEncrypt && !isDecrypt && !isAnalyze) || !url
|| Array.isArray(method) || Array.isArray(concurrency) || Array.isArray(data)
|| (!isAnalyze && (!cipherOrPlaintext || !blockSize || !paddingError))
) {