Skip to content

Commit

Permalink
Update parse.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Lutra-Fs authored Oct 27, 2024
1 parent d3598e3 commit a5e1ed1
Showing 1 changed file with 37 additions and 21 deletions.
58 changes: 37 additions & 21 deletions util/parse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,33 +30,49 @@ do
XML_FILE="./tmp/checker/${i}.xml"
RESULT_FILE="./tmp/parse/${i}-result.info"

# Extract version - look between <manifest and </manifest>
VERSION=$(extract_value "$XML_FILE" "<manifest" "</manifest>" "version")
# # Extract version - look between <manifest and </manifest>
# VERSION=$(extract_value "$XML_FILE" "<manifest" "</manifest>" "version")

# Extract URLs - look between <urls and </urls>
URL1=$(sed -n '/<urls/,/<\/urls>/p' "$XML_FILE" | \
sed -n '/edgedl\.me\.gvt1\.com/ {
s/.*codebase="https:\/\/edgedl\.me\.gvt1\.com\///
s/".*//
p
}' | head -1)
# # Extract URLs - look between <urls and </urls>
# URL1=$(sed -n '/<urls/,/<\/urls>/p' "$XML_FILE" | \
# sed -n '/edgedl\.me\.gvt1\.com/ {
# s/.*codebase="https:\/\/edgedl\.me\.gvt1\.com\///
# s/".*//
# p
# }' | head -1)

URL2=$(sed -n '/<urls/,/<\/urls>/p' "$XML_FILE" | \
sed -n '/dl\.google\.com/ {
s/.*codebase="https:\/\/dl\.google\.com\///
s/".*//
p
}' | head -1)
# URL2=$(sed -n '/<urls/,/<\/urls>/p' "$XML_FILE" | \
# sed -n '/dl\.google\.com/ {
# s/.*codebase="https:\/\/dl\.google\.com\///
# s/".*//
# p
# }' | head -1)

# Extract installer - look between <actions and </actions>
INSTALLER=$(extract_value "$XML_FILE" "<actions" "</actions>" "run")
# # Extract installer - look between <actions and </actions>
# INSTALLER=$(extract_value "$XML_FILE" "<actions" "</actions>" "run")

# Extract SHA256 - look between <packages and </packages>
SHA256=$(extract_value "$XML_FILE" "<packages" "</packages>" "hash_sha256")
# # Extract SHA256 - look between <packages and </packages>
# SHA256=$(extract_value "$XML_FILE" "<packages" "</packages>" "hash_sha256")

# Extract size - look between <packages and </packages>
SIZE=$(extract_value "$XML_FILE" "<packages" "</packages>" "size")
# # Extract size - look between <packages and </packages>
# SIZE=$(extract_value "$XML_FILE" "<packages" "</packages>" "size")

# Extract version - simpler pattern
VERSION=$(sed -n 's/.*manifest version="\([^"]*\)".*/\1/p' "$XML_FILE")

# Extract URLs - simpler patterns
URL1=$(sed -n 's/.*codebase="https:\/\/edgedl\.me\.gvt1\.com\/\([^"]*\)".*/\1/p' "$XML_FILE" | head -1)
URL2=$(sed -n 's/.*codebase="https:\/\/dl\.google\.com\/\([^"]*\)".*/\1/p' "$XML_FILE" | head -1)

# Extract installer name - simpler pattern
INSTALLER=$(sed -n 's/.*run="\([^"]*\)".*/\1/p' "$XML_FILE" | head -1)

# Extract SHA256 - simpler pattern
SHA256=$(sed -n 's/.*hash_sha256="\([^"]*\)".*/\1/p' "$XML_FILE")

# Extract size - simpler pattern
SIZE=$(sed -n 's/.*size="\([^"]*\)".*/\1/p' "$XML_FILE" | head -1)

# Write results to file
{
echo "$VERSION"
Expand Down

0 comments on commit a5e1ed1

Please sign in to comment.