Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 860ec08d4f | |||
| 60276f5c97 | |||
| 8616e78547 | |||
| 8327ee125b |
34
build.sh
34
build.sh
@@ -166,13 +166,14 @@ upload_release_asset() {
|
|||||||
local token="$2"
|
local token="$2"
|
||||||
local version="$3"
|
local version="$3"
|
||||||
local filename="$4"
|
local filename="$4"
|
||||||
|
local display_name="$5"
|
||||||
|
|
||||||
if [ ! -f "$filename" ]; then
|
if [ ! -f "$filename" ]; then
|
||||||
print_warning "Binary $filename not found, skipping upload"
|
print_warning "Binary $filename not found, skipping upload"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
print_status "Uploading $filename to release..."
|
print_status "Uploading $filename as '$display_name' to release..."
|
||||||
|
|
||||||
# Get release ID first
|
# Get release ID first
|
||||||
local release_id=$(curl -s -H "Authorization: token $token" \
|
local release_id=$(curl -s -H "Authorization: token $token" \
|
||||||
@@ -184,16 +185,13 @@ upload_release_asset() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Upload the asset
|
# Upload the asset using multipart/form-data
|
||||||
curl -X POST "$api_url/releases/$release_id/assets" \
|
curl -X POST "$api_url/releases/$release_id/assets" \
|
||||||
-H "Authorization: token $token" \
|
-H "Authorization: token $token" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-F "attachment=@$filename;filename=$display_name"
|
||||||
-T "$filename" \
|
|
||||||
--data-binary "@$filename" \
|
|
||||||
-G -d "name=$filename"
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
print_success "Uploaded $filename successfully"
|
print_success "Uploaded $filename as '$display_name' successfully"
|
||||||
else
|
else
|
||||||
print_warning "Failed to upload $filename"
|
print_warning "Failed to upload $filename"
|
||||||
return 1
|
return 1
|
||||||
@@ -211,7 +209,7 @@ create_gitea_release() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local token=$(cat "$HOME/.gitea_token" | tr -d '\n\r')
|
local token=$(cat "$HOME/.gitea_token" | tr -d '\n\r')
|
||||||
local api_url="https://git.laantungir.net:222/api/v1/repos/laantungir/otp"
|
local api_url="https://git.laantungir.net/api/v1/repos/laantungir/otp"
|
||||||
|
|
||||||
print_status "Creating Gitea release for $version..."
|
print_status "Creating Gitea release for $version..."
|
||||||
|
|
||||||
@@ -224,16 +222,16 @@ create_gitea_release() {
|
|||||||
if echo "$response" | grep -q '"id"'; then
|
if echo "$response" | grep -q '"id"'; then
|
||||||
print_success "Created release $version"
|
print_success "Created release $version"
|
||||||
|
|
||||||
# Upload binaries
|
# Upload binaries with descriptive names
|
||||||
upload_release_asset "$api_url" "$token" "$version" "otp-x86_64"
|
upload_release_asset "$api_url" "$token" "$version" "otp-x86_64" "otp-${version}-linux-x86_64"
|
||||||
upload_release_asset "$api_url" "$token" "$version" "otp-arm64"
|
upload_release_asset "$api_url" "$token" "$version" "otp-arm64" "otp-${version}-linux-arm64"
|
||||||
else
|
else
|
||||||
print_warning "Release may already exist or creation failed"
|
print_warning "Release may already exist or creation failed"
|
||||||
print_status "Response: $response"
|
print_status "Response: $response"
|
||||||
|
|
||||||
# Try to upload to existing release anyway
|
# Try to upload to existing release anyway
|
||||||
upload_release_asset "$api_url" "$token" "$version" "otp-x86_64"
|
upload_release_asset "$api_url" "$token" "$version" "otp-x86_64" "otp-${version}-linux-x86_64"
|
||||||
upload_release_asset "$api_url" "$token" "$version" "otp-arm64"
|
upload_release_asset "$api_url" "$token" "$version" "otp-arm64" "otp-${version}-linux-arm64"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,7 +246,7 @@ build_project() {
|
|||||||
|
|
||||||
# Build x86_64 only
|
# Build x86_64 only
|
||||||
print_status "Building OTP project for x86_64..."
|
print_status "Building OTP project for x86_64..."
|
||||||
CC=gcc make
|
make CC=gcc
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
mv otp otp-x86_64
|
mv otp otp-x86_64
|
||||||
print_success "x86_64 build completed successfully"
|
print_success "x86_64 build completed successfully"
|
||||||
@@ -259,8 +257,8 @@ build_project() {
|
|||||||
else
|
else
|
||||||
# Build both architectures
|
# Build both architectures
|
||||||
print_status "Building OTP project for x86_64..."
|
print_status "Building OTP project for x86_64..."
|
||||||
CC=gcc make clean
|
make clean
|
||||||
CC=gcc make
|
make CC=gcc
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
mv otp otp-x86_64
|
mv otp otp-x86_64
|
||||||
print_success "x86_64 build completed successfully"
|
print_success "x86_64 build completed successfully"
|
||||||
@@ -270,8 +268,8 @@ build_project() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
print_status "Building OTP project for ARM64/AArch64..."
|
print_status "Building OTP project for ARM64/AArch64..."
|
||||||
CC=aarch64-linux-gnu-gcc make clean
|
make clean
|
||||||
CC=aarch64-linux-gnu-gcc make
|
make CC=aarch64-linux-gnu-gcc
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
mv otp otp-arm64
|
mv otp otp-arm64
|
||||||
print_success "ARM64/AArch64 build completed successfully"
|
print_success "ARM64/AArch64 build completed successfully"
|
||||||
|
|||||||
BIN
otp-x86_64
Executable file
BIN
otp-x86_64
Executable file
Binary file not shown.
6
otp.c
6
otp.c
@@ -330,7 +330,7 @@ int interactive_mode(void) {
|
|||||||
void show_main_menu(void) {
|
void show_main_menu(void) {
|
||||||
|
|
||||||
|
|
||||||
printf("\n=========================== Main Menu - OTP v0.3.1 ===========================\n\n");
|
printf("\n=========================== Main Menu - OTP v0.3.5 ===========================\n\n");
|
||||||
|
|
||||||
printf(" \033[4mT\033[0mext encrypt\n"); //TEXT ENCRYPT
|
printf(" \033[4mT\033[0mext encrypt\n"); //TEXT ENCRYPT
|
||||||
printf(" \033[4mF\033[0mile encrypt\n"); //FILE ENCRYPT
|
printf(" \033[4mF\033[0mile encrypt\n"); //FILE ENCRYPT
|
||||||
@@ -2848,7 +2848,7 @@ int generate_ascii_armor(const char* chksum, uint64_t offset, const unsigned cha
|
|||||||
strcpy(*ascii_output, "-----BEGIN OTP MESSAGE-----\n");
|
strcpy(*ascii_output, "-----BEGIN OTP MESSAGE-----\n");
|
||||||
|
|
||||||
char temp_line[256];
|
char temp_line[256];
|
||||||
snprintf(temp_line, sizeof(temp_line), "Version: v0.3.1\n");
|
snprintf(temp_line, sizeof(temp_line), "Version: v0.3.5\n");
|
||||||
strcat(*ascii_output, temp_line);
|
strcat(*ascii_output, temp_line);
|
||||||
|
|
||||||
snprintf(temp_line, sizeof(temp_line), "Pad-ChkSum: %s\n", chksum);
|
snprintf(temp_line, sizeof(temp_line), "Pad-ChkSum: %s\n", chksum);
|
||||||
@@ -4394,7 +4394,7 @@ int handle_add_entropy_to_pad(const char* pad_chksum) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void print_usage(const char* program_name) {
|
void print_usage(const char* program_name) {
|
||||||
printf("OTP Cipher - One Time Pad Implementation v0.3.1\n");
|
printf("OTP Cipher - One Time Pad Implementation v0.3.5\n");
|
||||||
printf("Built for testing entropy system\n");
|
printf("Built for testing entropy system\n");
|
||||||
printf("Usage:\n");
|
printf("Usage:\n");
|
||||||
printf(" %s - Interactive mode\n", program_name);
|
printf(" %s - Interactive mode\n", program_name);
|
||||||
|
|||||||
Reference in New Issue
Block a user