Windows
$env:GEMINI_API_KEY=»TU_API_KEY»
[Environment]::SetEnvironmentVariable(«GEMINI_API_KEY», «TU_API_KEY», «User»)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import java.io.File fun main() { val fichero = "fichero.exe" // Obtener hash val process = ProcessBuilder( "powershell.exe", "-Command", "(Get-FileHash -Algorithm SHA256 \"$fichero\").Hash" ).start() val hash = process.inputStream.bufferedReader().readText().trim() process.waitFor() println("SHA-256: $hash") // Preguntar a Gemini val json = """{"model":"gemini-3.8-flash","input":"¿Te suena este hash SHA-256? $hash"}""" ProcessBuilder( "curl.exe", "-s", "-X", "POST", "https://generativelanguage.googleapis.com/v1beta/interactions", "-H", "x-goog-api-key: ${System.getenv("GEMINI_API_KEY")}", "-H", "Content-Type: application/json", "-d", json ).inheritIO().start().waitFor() } |
Unix
export GEMINI_API_KEY=»TU_API_KEY»
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import java.io.File fun main() { val fichero = "fichero.exe" // SHA-256 val p = ProcessBuilder("shasum", "-a", "256", fichero).start() val hash = p.inputStream.bufferedReader().readText().trim().split(" ")[0] println("SHA-256: $hash") // Gemini val json = """{"model":"gemini-3.8-flash","input":"¿Te suena este hash SHA-256? $hash"}""" ProcessBuilder( "curl", "-s", "-X", "POST", "https://generativelanguage.googleapis.com/v1beta/interactions", "-H", "x-goog-api-key: ${System.getenv("GEMINI_API_KEY")}", "-H", "Content-Type: application/json", "-d", json ).inheritIO().start().waitFor() } |

