Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
github.com/morbnie/convert-zipped-txt-file-from-ftp-server-to-csv
This small Go application will download a ZIP compressed file from an FTP server. Every TXT files in this ZIP compressed file will be extraced and saved as CSV files.
This application can be used for downloading ZIP compressed log files in TXT format from on an FTP Server. The TXT files will be extracted and saved as CSV files. These CSV files are then ready to be sent to visualization tool such as Tableau or Kibana/Elasticsearch (Elastic Stack).
Variable Name | Description | Example value |
---|---|---|
ftpHost | The value should include the hostname of the FTP server including the port. | ftp.example.com:21 |
ftpUser | The username of the user that has read access to the file. | myuser |
ftpPassword | The password of the user. | mypasswprd |
directory | The directory path of the user to where the file is located. The value can either be set as a varible in the main.go file or as a Command-line flag with the use of -directory. | folder1/folder2 |
filename | The name of the file that should be downloaded. If the application should run everyday and download a daily file in a format like "Logfile-30-01-2020.zip", use currentTime to set the day, month and year values. Use currentTime.Format("02") for day, currentTime.Format("01") for month and currentTime.Format("06") for year. For example: Logfile"+currentTime.Format("02")+"-"+currentTime.Format("01")+"-"+currentTime.Format("06")+".zip The value can either be set as a varible in the main.go file or as a Command-line flag with the use of -filename. | File.zip |
go run main.go -directory=folder1/folder2 -filename=File.zip
or go run main.go -directory folder1/folder2 -filename File.zip
First I set the variable values for connection to the FTP server by setting ftpHost for the hostname, ftpUser for the username and ftpPassword for the password. In the directory application/log I have a Zip File named Logfile-30-01-2020.zip. This Zip file contains one txt file names Logfile-30-01-2020.txt.
I run the application on the 30th of January 2020, and because I have set the varible filename as Logfile"+currentTime.Format("02")+"-"+currentTime.Format("01")+"-"+currentTime.Format("06")+".zip
the application will automatically set the current day. The logfiles are always located in the same directory, so i set directory as application/log
.
The txt file from the Zip file has now been extracted and saved as a CSV file in the output folder. I can now take this file and upload in my preferred Data Visualization tool.
Everyday a new Zip file will be uploaded to the FTP server (following the date format I have set in filenames), so I just need to run the application everyday to get the logfiles.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.