{"record":{"id":"c3d2c06b12cb0f2e","repo":"peass-ng/PEASS-ng","slug":"something-falied-reading-peass-script-from-url-p","errorCode":null,"errorMessage":"Something falied reading PEASS script from #{url_peass}","messagePattern":"Something falied reading PEASS script from #(.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"metasploit/peass.rb","lineNumber":289,"sourceCode":"      url_peass = datastore['CUSTOM_URL']\n    else\n      url_peass = datastore['WINPEASS'].to_s.strip.downcase == 'true' ? \"https://github.com/peass-ng/PEASS-ng/releases/latest/download/winPEASany_ofs.exe\" : \"https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh\"\n    end\n    # If URL is set, check if it is a valid URL or local file\n    if url_peass.include?(\"http://\") || url_peass.include?(\"https://\")\n      target = URI.parse url_peass\n      raise 'Invalid URL' unless target.scheme =~ /https?/\n      raise 'Invalid URL' if target.host.to_s.eql? ''\n      \n      res = fetch(target)\n      peass_script = res.body\n\n      raise \"Something failed downloading PEASS script from #{url_peass}\" if peass_script.length < 500\n\n    else\n      raise \"PEASS local file (#{url_peass}) does not exist!\" unless ::File.exist?(url_peass)        \n      peass_script = File.read(url_peass)\n      raise \"Something falied reading PEASS script from #{url_peass}\" if peass_script.length < 500\n    end\n\n    return peass_script\n  end\n\n  def aes_enc_peass(peass_script)\n    # Encrypt the PEASS script with AES (CBC Mode)\n    key = datastore[\"PASSWORD\"]\n    iv = OpenSSL::Cipher::Cipher.new('aes-256-cbc').random_iv\n    \n    c = OpenSSL::Cipher.new('aes-256-cbc').encrypt\n    c.iv = iv\n    c.key = key\n    encrypted = c.update(peass_script) + c.final\n    encrypted = [encrypted].pack('m')\n\n    return {\n      \"encrypted\" => encrypted,","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/metasploit/peass.rb#L271-L307","documentation":"After reading the local PEASS file, the module raises this error if the content is shorter than 500 characters, indicating the file read did not yield the real PEASS script (note the typo 'falied' in the message). This catches empty, placeholder, or wrong files.","triggerScenarios":"File.exist? passes but File.read returns a tiny file: an empty stub, an HTML error page saved as linpeas.sh, a partially downloaded/truncated file, or a symlink to a nearly empty target.","commonSituations":"'wget' on the attack box saved a 404 page to linpeas.sh; file was created with touch but never populated; disk full during download truncated the file; copied a link instead of the file.","solutions":["Run 'wc -c <file>' to check its size and re-download the genuine PEASS release file","Verify the file content with 'head' — if it is HTML, the original download failed; fetch again from the official release","Re-copy the correct linpeas.sh / winPEASany_ofs.exe to the path in CUSTOM_URL","Alternatively unset CUSTOM_URL and let the module download from the official GitHub URL"],"exampleFix":"# before\nset CUSTOM_URL /tmp/linpeas.sh  # 320-byte HTML error page\n# after\nwget https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh -O /tmp/linpeas.sh\nset CUSTOM_URL /tmp/linpeas.sh","handlingStrategy":"validation","validationCode":"raise ArgumentError, 'file too small to be PEASS' if File.size(path) < 500","typeGuard":null,"tryCatchPattern":"begin\n  content = File.read(path)\n  raise 'truncated/placeholder file' if content.length < 500\nrescue StandardError => e\n  print_error(\"Bad PEASS file: #{e.message}\")\nend","preventionTips":["Check file size (wc -c) after downloading","Inspect head of file to ensure it is a script/PE, not an HTML error page","Re-download from the official release if the download failed","Use checksums when hosting files yourself"],"tags":["filesystem","metasploit","file-content","validation"],"backgroundTag":"file-not-found","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}