Benign go Download

github.com/luispagarcia/currency_repo v0.0.0-20260717071830-d321a98d1f50

Basename is uppercase README.mdGitHub Actions workflow definition path
SHA-256d40d074217e7cd4a7a25af42c60ba65705f05b2d3373f46d64328075fc9998ec

Evidence

imports encoding/json lines 1–22
1package main
2
3import (
4 "encoding/json"
5 "fmt"
6 "io/ioutil"
7 "net/http"
8 "os"
9 "strings"
10 "time"
11)
12
13// Define una estructura para mapear la respuesta JSON.
14type ApiResponse struct {
15 Result string `json:"Result"`
16 Data []string `json:"result"`
17 Date string `json:"date"`
18}
19
20// HistoricEntry is the shape stored in historic_tipo_de_cambio_bi.json
21type HistoricEntry struct {
22 Result string `jso …
Constructs a Go HTTP client lines 24–42
24:25… nta"`
25 Date string `json:"date"`
26}
27
28func main() {
29 urlStr := "https://www.corporacionbi.com/gt/bancoindustrial/wp-content/plugins/jevelin_showcase_exchange_rate/service/mod_moneda.php"
30 method := "POST"
31
32 payload := strings.NewReader("action=getMoneda")
33
34 client := &http.Client{}
35 req, err := http.NewRequest(method, urlStr, payload)
36
37 if err != nil {
⋯5 lines
Browser Sec-CH client-hint header lines 45–64
45:13… Add("Origin", "https://www.corporacionbi.com")
46 req.Header.Add("Sec-Fetch-Dest", "empty")
47 req.Header.Add("Sec-Fetch-Mode", "cors")
48 req.Header.Add("Sec-Fetch-Site", "same-origin")
49 req.Header.Add("Sec-GPC", "1")
50 req.Header.Add("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36")
51 req.Header.Add("X-Requested-With", "XMLHttpRequest")
52 req.Header.Add("sec-ch-ua", `"Chromium";v="116", "Not)A;Brand";v="24", "Brave";v="116"`)
53 req.Header.Add("sec-ch-ua-mobile", "?0")
54 req.Header.Add("sec-ch-ua-platform", `"macOS"`)
55
56 res, err := client.Do(req)
57 if err != nil {
58 fmt.Println(err)
⋯6 lines
Go JSON unmarshal call lines 69–78
69:8… erializa la respuesta JSON.
70 var apiResponse ApiResponse
71 err = json.Unmarshal(body, &apiResponse)
72 if err != nil {
73 fmt.Println(err)
⋯5 lines
Go JSON marshal call lines 84–101
84 currentDate := time.Now().In(location).Format("2006-01-02 15:04:05")
85 // Agrega la nueva propiedad con un string vacío.
86 apiResponse.Date = currentDate
87
88 // Serializa el objeto modificado a JSON.
89 modifiedJSON, err := json.Marshal(apiResponse)
90 if err != nil {
91 fmt.Println(err)
92 return
93 }
94
95 err = ioutil.WriteFile("./currency_all/tipo_de_cambio_bi.json", modifiedJSON, 0644)
96 if err != nil {
97 fmt.Println(err)
⋯4 lines

No evidence locations were recorded for this file. Raw result

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.