Skip to content

Commit

Permalink
start
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizumo-prjkt committed Aug 8, 2023
0 parents commit 99402ee
Show file tree
Hide file tree
Showing 16 changed files with 343 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pack/pak.deb
pak.deb
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"[markdown]": {
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true,
}
}
}
50 changes: 50 additions & 0 deletions Security.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[<< Back to README](readme.md)

# Security

This page is dedicated on the technical use case of SuperUser password Handling

If you don't like it, then please don't use the repo, for better solution

This repo is always transparent when handling sensitive data, which is the sudo password

This is the line code that implement such:

```
if [ "$(/usr/bin/id -u)" -ne 0 ]; then
dialog --backtitle "Error" --title "Cannot Continue without SuperUser" --msgbox "The script cannot run under user session\n\nThis script requires root access to continue..." 0 0
password=$(dialog --backtitle "Enter Password" \
--title "Enter sudo Password" \
--clear \
--passwordbox "Enter sudo password, all input texts are invisible for security reasons\n\nSee Security.md for more info, if it's wrong, the script wont launch again" 0 0 \
2>&1 >/dev/tty)
grab=$?
case $grab in
1)
unset password # Security reasons
exit 1
;;
esac
echo "$password" | sudo -S "$0" "$@"
grab=$?
case $grab in
1)
clear
unset password
echo "Wrong Password, relaunch again, at least with sudo main.sh to avoid this"
echo "If you have already launched this sucessfully, then that means its ok. Im currently trying to figure out this"
exit $grab
;;
esac
exit 0
fi
unset password
```

As you can see, the binary software that i used is dialog, a TUI Software that may not require a windowing session except if its launched on Terminal Emulators

I could use `zenity` but this method is better because all of it are in the terminal session, in which `zenity` usually take 3 seconds just to load a License Agreement and i personally feel it's annoying

Well, as for the passwords, the variables that handle the passwords get cleared out by `unset` which is a tool to remove variables like it doesn't exist. So its a minimum guarantee that your sudo password isn't compromised. Unless you `|` (piped) it

Binary file added img/1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added lc/LCTXT.txt
Empty file.
50 changes: 50 additions & 0 deletions lc/MS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
MICROSOFT SOFTWARE LICENSE TERMS
MICROSOFT VISUAL STUDIO CODE
These license terms are an agreement between you and Microsoft Corporation (or based on where you live, one of its affiliates). They apply to the software named above. The terms also apply to any Microsoft services or updates for the software, except to the extent those have different terms.

IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE RIGHTS BELOW.

1. INSTALLATION AND USE RIGHTS.

General. You may use any number of copies of the software to develop and test your applications, including deployment within your internal corporate network.
Demo use. The uses permitted above include use of the software in demonstrating your applications.

Third Party Components. The software may include third party components with separate legal notices or governed by other agreements, as may be described in the ThirdPartyNotices file accompanying the software.
Extensions. The software gives you the option to download other Microsoft and third party software packages from our extension marketplace or package managers. Those packages are under their own licenses, and not this agreement. Microsoft does not distribute, license or provide any warranties for any of the third party packages. By accessing or using our extension marketplace, you agree to the extension marketplace terms located at https://aka.ms/vsmarketplace-ToU.

2. DATA.

Data Collection. The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may opt-out of many of these scenarios, but not all, as described in the product documentation located at https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting. There may also be some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with Microsoft’s privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
Processing of Personal Data. To the extent Microsoft is a processor or subprocessor of personal data in connection with the software, Microsoft makes the commitments in the European Union General Data Protection Regulation Terms of the Online Services Terms to all customers effective May 25, 2018, at https://docs.microsoft.com/legal/gdpr.

UPDATES. The software may periodically check for updates and download and install them for you. You may obtain updates only from Microsoft or authorized sources. Microsoft may need to update your system to provide you with updates. You agree to receive these automatic updates without any additional notice. Updates may not include or support all existing software features, services, or peripheral devices. If you do not want automatic updates, you may turn them off by following the instructions in the documentation at https://go.microsoft.com/fwlink/?LinkID=616397.

FEEDBACK. If you give feedback about the software to Microsoft, you give to Microsoft, without charge, the right to use, share and commercialize your feedback in any way and for any purpose. You will not give feedback that is subject to a license that requires Microsoft to license its software or documentation to third parties because we include your feedback in them. These rights survive this agreement.

SCOPE OF LICENSE. This license applies to the Visual Studio Code product. Source code for Visual Studio Code is available at https://github.com/Microsoft/vscode under the MIT license agreement. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the source code for the software except and solely to the extent required by third party licensing terms governing use of certain open source components that may be included in the software; remove, minimize, block or modify any notices of Microsoft or its suppliers in the software; use the software in any way that is against the law; share, publish, rent or lease the software, or provide the software as a stand-alone offering for others to use.

SUPPORT SERVICES. Because this software is “as is,” we may not provide support services for it.

ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.

EXPORT RESTRICTIONS. You must comply with all domestic and international export laws and regulations that apply to the software, which include restrictions on destinations, end-users, and end use. For further information on export restrictions, see https://www.microsoft.com/exporting.

APPLICABLE LAW. If you acquired the software in the United States, Washington law applies to interpretation of and claims for breach of this agreement, and the laws of the state where you live apply to all other claims. If you acquired the software in any other country, its laws apply.

CONSUMER RIGHTS; REGIONAL VARIATIONS. This agreement describes certain legal rights. You may have other rights, including consumer rights, under the laws of your state or country. Separate and apart from your relationship with Microsoft, you may also have rights with respect to the party from which you acquired the software. This agreement does not change those other rights if the laws of your state or country do not permit it to do so. For example, if you acquired the software in one of the below regions, or mandatory country law applies, then the following provisions apply to you:

Australia. You have statutory guarantees under the Australian Consumer Law and nothing in this agreement is intended to affect those rights.
Canada. If you acquired this software in Canada, you may stop receiving updates by turning off the automatic update feature, disconnecting your device from the Internet (if and when you re-connect to the Internet, however, the software will resume checking for and installing updates), or uninstalling the software. The product documentation, if any, may also specify how to turn off updates for your specific device or software.
Germany and Austria. Warranty. The properly licensed software will perform substantially as described in any Microsoft materials that accompany the software. However, Microsoft gives no contractual guarantee in relation to the licensed software.

Limitation of Liability. In case of intentional conduct, gross negligence, claims based on the Product Liability Act, as well as, in case of death or personal or physical injury, Microsoft is liable according to the statutory law.

Subject to the foregoing clause (ii), Microsoft will only be liable for slight negligence if Microsoft is in breach of such material contractual obligations, the fulfillment of which facilitate the due performance of this agreement, the breach of which would endanger the purpose of this agreement and the compliance with which a party may constantly trust in (so-called "cardinal obligations"). In other cases of slight negligence, Microsoft will not be liable for slight negligence.

DISCLAIMER OF WARRANTY. The software is licensed “as-is.” You bear the risk of using it. Microsoft gives no express warranties, guarantees or conditions. To the extent permitted under your local laws, Microsoft excludes the implied warranties of merchantability, fitness for a particular purpose and non-infringement.

LIMITATION ON AND EXCLUSION OF DAMAGES. You can recover from Microsoft and its suppliers only direct damages up to U.S. $5.00. You cannot recover any other damages, including consequential, lost profits, special, indirect or incidental damages.

This limitation applies to (a) anything related to the software, services, content (including code) on third party Internet sites, or third party applications; and (b) claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.

It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your state or country may not allow the exclusion or limitation of incidental, consequential or other damages.
190 changes: 190 additions & 0 deletions main.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
#!/bin/bash
clear
case $(uname -m) in
x86_64)
echo " "
;;
armv7a)
echo "32 Bit ARM is not supported, sorry"
exit 1
;;
*)
echo "Sorry. VSCode for $(uname -m) is not available at the moment..."
exit 1
;;
esac
if [ "$(/usr/bin/id -u)" -ne 0 ]; then
dialog --backtitle "Error" --title "Cannot Continue without SuperUser" --msgbox "The script cannot run under user session\n\nThis script requires root access to continue..." 0 0
password=$(dialog --backtitle "Enter Password" \
--title "Enter sudo Password" \
--clear \
--passwordbox "Enter sudo password, all input texts are invisible for security reasons\n\nSee Security.md for more info, if it's wrong, the script wont launch again" 0 0 \
2>&1 >/dev/tty)
grab=$?
case $grab in
1)
unset password # Security reasons
exit 1
;;
esac
echo "$password" | sudo -S "$0" "$@"
grab=$?
case $grab in
1)
clear
unset password
echo "Wrong Password, relaunch again, at least with sudo main.sh to avoid this"
echo "If you have already launched this sucessfully, then that means its ok. Im currently trying to figure out this"
exit $grab
;;
esac
exit 0
fi

unset password

# CACHING
TITLE="VS Code Installer"
BACK="VS Code Installer - Version 1"

# COLORS!
# setaf - foreground
# setab - background
#RED=$(tput setaf 1)
#GREEN=$(tput setaf 2)
#YELLOW=$(tput setaf 3)
#BLUE=$(tput setaf 4)
#MAGENTA=$(tput setaf 5)
#CYAN=$(tput setaf 6)
#WHITE=$(tput setaf 7)
#RESET=$(tput sgr0)

# Important Function (Not really)
function msg () {
echo "$1"
}

# Cached Function

function datetime () {
MONTH_DATE_YEAR=$(date +%m-%d-%y)
TIMECOUNT=$(date +%T)
msg "$MONTH_DATE_YEAR $TIMECOUNT"
}

function extract () {
7za x pack/pak.7z.001
}

function install () {
sudo apt install -y ./pak.deb
}

function clean () {
rm -rf *.deb
}

function remove () {
sudo apt remove code -y
}

function chk_spc () {
case $(uname -m) in
x86_64)
msg "AVAILABLE for 64 Bit: $(cat pack/VERSION_AMD64)"
;;
*)
msg "UNAVAILABLE"
BLOCK=1
;;
esac
}

function chk_ist () {
if [ -e "/usr/bin/code" ] && [ -e "/usr/share/code" ]; then
msg "Installed"
else
msg "Not Installed"
fi
}

# Check Packages
packages=("7za" "dialog")
for pkg in "${packages[@]}" ; do
msg "$(datetime) : Checking if you have: $pkg"
sleep 1
cmd=$(command -v "$pkg" 2>/dev/null)
if [ -n "$cmd" ]; then
msg "$(datetime) : $pkg Exits, Located at: '$cmd'"
else
msg "$(datetime) : Package $pkg not installed, please install it using 'sudo apt install $pkg' then continue"
sleep 3
exit 1
fi
done
sleep 2
clear

function welcome () {
dialog --infobox "VS Code Installer\n\nNot Related to Microsoft Whatsoever, but here to let you install VS Code anyways..."
agree
}

function agree () {
dialog --backtitle "Microsoft Visual Studio Code License Terms" --title "VS Code License Agreement" --yes-label "Agree to Microsoft License Agreement" --no-label "Exit" --yesno "$(cat lc/MS.txt)" 0 0
lcx=$?
case $lcx in
0)
menu
;;
1)
exit 1
;;
esac
}

# Menu
function menu () {
menu=$(dialog \
--backtitle "VS Code Package Manager By SUFandom" \
--title "Main Menu" \
--clear \
--menu "Choose an Option" 0 0 0 \
"Install" "Install VS Code from Microsoft. Status: $(chk_spc)" \
"Remove" "Status: $(chk_ist) : Removes MS VSCode" \
"About" "About" \
2>&1 >/dev/tty)
lcx=$?
case $lcx in
1)
exit 1
;;
esac
case $menu in
"Install")
clear
msg "This Process Job is set in Verbose to ensure Stability..."
msg "Starting Process..."
sleep 3
extract
install
clean
msg "Done..."
sleep 3
menu
;;
"Remove")
clear
remove
;;
"About")
dialog --backtitle "About" --title "VS Code Installer About" --msgbox "VS Code Package Manager by SUFandom\n\nVersion 1\n\nThis script's purpose is just simply install Microsoft's VS Code Easily...\n\nRead Microsoft's License about VS Code in here:\nhttps://code.visualstudio.com/license?lang=en" 0 0
menu
;;
esac

}

# Init Area
# DONOTADD ANYTHING
welcome
1 change: 1 addition & 0 deletions pack/VERSION_AMD64
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.81 Microsoft Build
Binary file added pack/pak.7z.001
Binary file not shown.
Binary file added pack/pak.7z.002
Binary file not shown.
Binary file added pack/pak.7z.003
Binary file not shown.
Binary file added pack/pak.7z.004
Binary file not shown.
Binary file added pack/pak.7z.005
Binary file not shown.
Binary file added pack/pak.7z.006
Binary file not shown.
Binary file added pack/pak.7z.007
Binary file not shown.
41 changes: 41 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# VS Install

Install VS Code Easily by cloning this repo

Badges

[![github-forks](https://img.shields.io/github/forks/SUFandom/vs-install?label=Fork&style=appveyor&logo=github)](https://github.com/SUFandom/vs-install) [![github-stars](https://img.shields.io/github/stars/SUFandom/vs-install?style=appveyor&logo=github)](https://github.com/SUFandom/vs-install) ![vsi](https://img.shields.io/badge/VS--Code--Version-1.81-BrightGreen)

---

[Check Microsoft's VS Code License](https://code.visualstudio.com/license?lang=en)

[Check Security.md for Sudo Password Handling session](Security.md)

**VS-Install's Purpose is to make VS Code Install Easy and only in terminal session**

![img1_gif](img/1.gif)

And no browser is required, just:

```
# Clone the Repo
$ git clone https://github.com/SUFandom/vs-install
# CD and Run
$ cd vs-install
$ chmod +x *.sh && ./main.sh
```

and there you go!

## Issues

- The Current issue of this repo is that, this only works on Linux Debian/Ubuntu and only supports amd64/x86_64 at the moment

- The Script Brodcast some Error even tho the Sudo password was right

0 comments on commit 99402ee

Please sign in to comment.