All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.shiftleft.js2cpg.passes.PrivateKeyFilePass.scala Maven / Gradle / Ivy

There is a newer version: 0.3.3
Show newest version
package io.shiftleft.js2cpg.passes

import io.shiftleft.codepropertygraph.Cpg
import io.shiftleft.js2cpg.core.Report
import io.shiftleft.utils.IOUtils

import java.nio.file.Path
import scala.util.matching.Regex

class PrivateKeyFilePass(filenames: List[(Path, Path)], cpg: Cpg, report: Report)
    extends ConfigPass(filenames, cpg, report) {

  private val PRIVATE_KEY: Regex = """.*RSA\sPRIVATE\sKEY.*""".r

  override def fileContent(filePath: Path): Seq[String] = Seq("Content omitted for security reasons.")

  override def generateParts(): Array[(Path, Path)] =
    super.generateParts().filter(p => IOUtils.readLinesInFile(p._1).exists(PRIVATE_KEY.matches))

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy