init kretacli
This commit is contained in:
commit
96b8700a57
14 changed files with 1188 additions and 0 deletions
63
.gitattributes
vendored
Normal file
63
.gitattributes
vendored
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
###############################################################################
|
||||||
|
# Set default behavior to automatically normalize line endings.
|
||||||
|
###############################################################################
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Set default behavior for command prompt diff.
|
||||||
|
#
|
||||||
|
# This is need for earlier builds of msysgit that does not have it on by
|
||||||
|
# default for csharp files.
|
||||||
|
# Note: This is only used by command line
|
||||||
|
###############################################################################
|
||||||
|
#*.cs diff=csharp
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Set the merge driver for project and solution files
|
||||||
|
#
|
||||||
|
# Merging from the command prompt will add diff markers to the files if there
|
||||||
|
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||||
|
# the diff markers are never inserted). Diff markers may cause the following
|
||||||
|
# file extensions to fail to load in VS. An alternative would be to treat
|
||||||
|
# these files as binary and thus will always conflict and require user
|
||||||
|
# intervention with every merge. To do so, just uncomment the entries below
|
||||||
|
###############################################################################
|
||||||
|
#*.sln merge=binary
|
||||||
|
#*.csproj merge=binary
|
||||||
|
#*.vbproj merge=binary
|
||||||
|
#*.vcxproj merge=binary
|
||||||
|
#*.vcproj merge=binary
|
||||||
|
#*.dbproj merge=binary
|
||||||
|
#*.fsproj merge=binary
|
||||||
|
#*.lsproj merge=binary
|
||||||
|
#*.wixproj merge=binary
|
||||||
|
#*.modelproj merge=binary
|
||||||
|
#*.sqlproj merge=binary
|
||||||
|
#*.wwaproj merge=binary
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# behavior for image files
|
||||||
|
#
|
||||||
|
# image files are treated as binary by default.
|
||||||
|
###############################################################################
|
||||||
|
#*.jpg binary
|
||||||
|
#*.png binary
|
||||||
|
#*.gif binary
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# diff behavior for common document formats
|
||||||
|
#
|
||||||
|
# Convert binary document formats to text before diffing them. This feature
|
||||||
|
# is only available from the command line. Turn it on by uncommenting the
|
||||||
|
# entries below.
|
||||||
|
###############################################################################
|
||||||
|
#*.doc diff=astextplain
|
||||||
|
#*.DOC diff=astextplain
|
||||||
|
#*.docx diff=astextplain
|
||||||
|
#*.DOCX diff=astextplain
|
||||||
|
#*.dot diff=astextplain
|
||||||
|
#*.DOT diff=astextplain
|
||||||
|
#*.pdf diff=astextplain
|
||||||
|
#*.PDF diff=astextplain
|
||||||
|
#*.rtf diff=astextplain
|
||||||
|
#*.RTF diff=astextplain
|
366
.gitignore
vendored
Normal file
366
.gitignore
vendored
Normal file
|
@ -0,0 +1,366 @@
|
||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
##
|
||||||
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.rsuser
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Mono auto generated files
|
||||||
|
mono_crash.*
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
[Ww][Ii][Nn]32/
|
||||||
|
[Aa][Rr][Mm]/
|
||||||
|
[Aa][Rr][Mm]64/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Oo]ut/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# Visual Studio 2017 auto generated files
|
||||||
|
Generated\ Files/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUnit
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
nunit-*.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# Benchmark Results
|
||||||
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
|
# .NET Core
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
# ASP.NET Scaffolding
|
||||||
|
ScaffoldingReadMe.txt
|
||||||
|
|
||||||
|
# StyleCop
|
||||||
|
StyleCopReport.xml
|
||||||
|
|
||||||
|
# Files built by Visual Studio
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_h.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.iobj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.ipdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*_wpftmp.csproj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# Visual Studio Trace Files
|
||||||
|
*.e2e
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool
|
||||||
|
.axoCover/*
|
||||||
|
!.axoCover/settings.json
|
||||||
|
|
||||||
|
# Coverlet is a free, cross platform Code Coverage Tool
|
||||||
|
coverage*.json
|
||||||
|
coverage*.xml
|
||||||
|
coverage*.info
|
||||||
|
|
||||||
|
# Visual Studio code coverage results
|
||||||
|
*.coverage
|
||||||
|
*.coveragexml
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# NuGet Symbol Packages
|
||||||
|
*.snupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/[Pp]ackages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/[Pp]ackages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/[Pp]ackages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
*.appx
|
||||||
|
*.appxbundle
|
||||||
|
*.appxupload
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!?*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Including strong name files can present a security risk
|
||||||
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
|
#*.snk
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
ServiceFabricBackup/
|
||||||
|
*.rptproj.bak
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
*.ndf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
*.rptproj.rsuser
|
||||||
|
*- [Bb]ackup.rdl
|
||||||
|
*- [Bb]ackup ([0-9]).rdl
|
||||||
|
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# CodeRush personal settings
|
||||||
|
.cr/personal
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it
|
||||||
|
# tools/**
|
||||||
|
# !tools/packages.config
|
||||||
|
|
||||||
|
# Tabs Studio
|
||||||
|
*.tss
|
||||||
|
|
||||||
|
# Telerik's JustMock configuration file
|
||||||
|
*.jmconfig
|
||||||
|
|
||||||
|
# BizTalk build output
|
||||||
|
*.btp.cs
|
||||||
|
*.btm.cs
|
||||||
|
*.odx.cs
|
||||||
|
*.xsd.cs
|
||||||
|
|
||||||
|
# OpenCover UI analysis results
|
||||||
|
OpenCover/
|
||||||
|
|
||||||
|
# Azure Stream Analytics local run output
|
||||||
|
ASALocalRun/
|
||||||
|
|
||||||
|
# MSBuild Binary and Structured Log
|
||||||
|
*.binlog
|
||||||
|
|
||||||
|
# NVidia Nsight GPU debugger configuration file
|
||||||
|
*.nvuser
|
||||||
|
|
||||||
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
|
.mfractor/
|
||||||
|
|
||||||
|
# Local History for Visual Studio
|
||||||
|
.localhistory/
|
||||||
|
|
||||||
|
# BeatPulse healthcheck temp database
|
||||||
|
healthchecksdb
|
||||||
|
|
||||||
|
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||||
|
MigrationBackup/
|
||||||
|
|
||||||
|
# Ionide (cross platform F# VS Code tools) working folder
|
||||||
|
.ionide/
|
||||||
|
|
||||||
|
# Fody - auto-generated XML schema
|
||||||
|
FodyWeavers.xsd
|
||||||
|
|
||||||
|
# build shit
|
||||||
|
build/
|
14
.idea/.idea.KretaCLI/.idea/.gitignore
generated
vendored
Normal file
14
.idea/.idea.KretaCLI/.idea/.gitignore
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider ignored files
|
||||||
|
/.idea.KretaCLI.iml
|
||||||
|
/contentModel.xml
|
||||||
|
/modules.xml
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
/dictionaries
|
4
.idea/.idea.KretaCLI/.idea/encodings.xml
generated
Normal file
4
.idea/.idea.KretaCLI/.idea/encodings.xml
generated
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||||
|
</project>
|
8
.idea/.idea.KretaCLI/.idea/indexLayout.xml
generated
Normal file
8
.idea/.idea.KretaCLI/.idea/indexLayout.xml
generated
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/.idea.KretaCLI/.idea/vcs.xml
generated
Normal file
6
.idea/.idea.KretaCLI/.idea/vcs.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
25
KretaCLI.sln
Normal file
25
KretaCLI.sln
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.9.34407.89
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "KretaCLI", "KretaCLI\KretaCLI.vbproj", "{3253C6CB-65FC-4FFE-8B84-E20957B1A784}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{3253C6CB-65FC-4FFE-8B84-E20957B1A784}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3253C6CB-65FC-4FFE-8B84-E20957B1A784}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3253C6CB-65FC-4FFE-8B84-E20957B1A784}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3253C6CB-65FC-4FFE-8B84-E20957B1A784}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {B0BF5AAE-26EE-462A-8815-57990639EEBE}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
13
KretaCLI/KretaCLI.vbproj
Normal file
13
KretaCLI/KretaCLI.vbproj
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<RootNamespace>KretaCLI</RootNamespace>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
568
KretaCLI/Program.vb
Normal file
568
KretaCLI/Program.vb
Normal file
|
@ -0,0 +1,568 @@
|
||||||
|
Imports System.IO
|
||||||
|
Imports System.Net.Http
|
||||||
|
Imports System.Reflection
|
||||||
|
Imports System.Runtime.InteropServices
|
||||||
|
Imports System.Security.Cryptography
|
||||||
|
Imports System.Text
|
||||||
|
Imports Newtonsoft.Json.Linq
|
||||||
|
|
||||||
|
Module Program
|
||||||
|
Sub Main(args As String())
|
||||||
|
Console.ForegroundColor = ConsoleColor.Red
|
||||||
|
Console.WriteLine(
|
||||||
|
"Figyelmeztetés: Ennek az programnak a használatával elfogadod, hogy bármi kárért én nem vállalok felelősséget.")
|
||||||
|
Console.WriteLine(
|
||||||
|
"Csak saját felhasználásra alkalmas ez a program. (3rd party unofficial Kréta frontend)" + vbCrLf)
|
||||||
|
Console.ForegroundColor = ConsoleColor.Gray
|
||||||
|
If args.Length > 0 AndAlso args(0) = "schools" Then
|
||||||
|
If args.Length > 1 Then
|
||||||
|
If args.Length > 2 Then
|
||||||
|
Dim argums = ""
|
||||||
|
For i = 1 To args.Length - 1
|
||||||
|
If i = args.Length - 1 Then
|
||||||
|
argums += args(i)
|
||||||
|
Else
|
||||||
|
argums += args(i) + " "
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
GetSchools(argums).Wait()
|
||||||
|
Else
|
||||||
|
GetSchools(args(1)).Wait()
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Nincs elég paraméter! (schools <Iskola neve/azonosítója>)")
|
||||||
|
End If
|
||||||
|
ElseIf args.Length > 0 AndAlso args(0) = "auth" Then
|
||||||
|
if not args.Length > 2 andalso not args(1) = "refresh" andalso not args(1) = "logout" Then
|
||||||
|
Console.WriteLine("Nincs elég paraméter! (auth login <felhasználónév>@<iskola-azonosító>)")
|
||||||
|
Console.WriteLine("Vagy (auth refresh) ha frissíteni akarod a bejelentkezésed")
|
||||||
|
Console.WriteLine("Vagy ha kiszeretnél jelentkezni, (auth logout).")
|
||||||
|
exit sub
|
||||||
|
end if
|
||||||
|
If args(1) = "login" Then
|
||||||
|
if not args(2).Contains("@") then
|
||||||
|
Console.WriteLine("Elfelejtetted a @-ot! (auth login <felhasználónév>@<iskola-azonosító>)")
|
||||||
|
Else
|
||||||
|
Dim split As String() = args(2).Split("@")
|
||||||
|
Console.WriteLine("Add meg a jelszavad:")
|
||||||
|
Dim password As String = readpassword()
|
||||||
|
getBearer(split(0), password, split(1)).Wait()
|
||||||
|
end if
|
||||||
|
elseif args(1) = "refresh" Then
|
||||||
|
AuthRefreshToken().wait()
|
||||||
|
elseif args(1) = "logout" Then
|
||||||
|
if not File.Exists(GetStartupPath() + "loginData.json") Then
|
||||||
|
Console.WriteLine("Miért szeretnél kijelentkezni, ha nem is vagy bejelentkezve?")
|
||||||
|
exit sub
|
||||||
|
End If
|
||||||
|
Console.WriteLine("FIGYELMEZTETÉS: Kijelentkezni készülsz, biztos vagy benne hogy folytatod?")
|
||||||
|
Console.WriteLine("i(gen) / n(em) (y/n)")
|
||||||
|
Dim answer As String = Console.ReadLine()
|
||||||
|
if answer = "i" or answer = "igen" or answer = "y" or answer = "yes" Then
|
||||||
|
Console.WriteLine("UTOLSÓ FIGYELMEZTETÉS: Még mindig ki szeretnél jelentkezni?")
|
||||||
|
Console.WriteLine("Ha igen, akkor írd be az iskolád azonosítóját. (pl. klik06982123)")
|
||||||
|
Dim answer2 As String = ReadPassword()
|
||||||
|
dim logindata as string = GetStartupPath() + "loginData.json"
|
||||||
|
dim jsonString as string = file.ReadAllText(logindata)
|
||||||
|
dim jsonObject as JObject = JObject.Parse(jsonString)
|
||||||
|
dim school as string = jsonObject("institute_code").ToString()
|
||||||
|
if answer2.ToLower() = school.ToLower() Then
|
||||||
|
revokeRefreshToken().Wait()
|
||||||
|
File.Delete(logindata)
|
||||||
|
Console.WriteLine("Sikeresen kijelentkeztél.")
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Az iskolád azonosítója nem egyezik a bejelentkezett iskoládéval.")
|
||||||
|
Console.WriteLine("Kijelentkezés megszakítva.")
|
||||||
|
End If
|
||||||
|
end if
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Nincs elég paraméter! (auth login <felhasználónév>@<iskola-azonosító>)")
|
||||||
|
Console.WriteLine("Vagy (auth refresh) ha frissíteni akarod a bejelentkezésed")
|
||||||
|
Console.WriteLine("Vagy ha kiszeretnél jelentkezni, (auth logout).")
|
||||||
|
End If
|
||||||
|
elseif args.Length > 0 andalso args(0) = "help" Then
|
||||||
|
Console.WriteLine("KRÉTA CLI " + Version)
|
||||||
|
Console.WriteLine(vbcrlf)
|
||||||
|
Console.Writeline("Parancsok:")
|
||||||
|
Console.ForegroundColor = ConsoleColor.Yellow
|
||||||
|
Console.Write("auth ")
|
||||||
|
Console.ForegroundColor = ConsoleColor.Gray
|
||||||
|
Console.Write("<felhasználónév>@<iskola-azonosító>")
|
||||||
|
Console.WriteLine(vbtab + " - Bejelentkezés a fiókba (Token generálás)")
|
||||||
|
Console.ForegroundColor = consolecolor.DarkCyan
|
||||||
|
Console.Writeline(vbTab + "Példa: hatizsak@klik06982123")
|
||||||
|
Console.WriteLine()
|
||||||
|
Console.ForegroundColor = ConsoleColor.Yellow
|
||||||
|
Console.Write("auth ")
|
||||||
|
Console.ForegroundColor = ConsoleColor.Gray
|
||||||
|
Console.Write("refresh")
|
||||||
|
Console.WriteLine(vbtab + " - Token frissítése")
|
||||||
|
Console.ForegroundColor = ConsoleColor.DarkCyan
|
||||||
|
Console.WriteLine()
|
||||||
|
Console.ForegroundColor = ConsoleColor.Yellow
|
||||||
|
Console.Write("auth ")
|
||||||
|
Console.ForegroundColor = ConsoleColor.Gray
|
||||||
|
Console.Write("logout")
|
||||||
|
Console.WriteLine(vbtab + " - Kijelentkezés")
|
||||||
|
Console.WriteLine()
|
||||||
|
Console.ForegroundColor = ConsoleColor.Yellow
|
||||||
|
Console.Write("schools ")
|
||||||
|
Console.ForegroundColor = ConsoleColor.Gray
|
||||||
|
Console.Write("<Iskola neve/azonosítója>")
|
||||||
|
Console.WriteLine(vbtab + " - Iskolák keresése")
|
||||||
|
Console.ForegroundColor = ConsoleColor.DarkCyan
|
||||||
|
Console.WriteLine(vbTab + "Példa: schools klik")
|
||||||
|
Console.WriteLine()
|
||||||
|
Console.ForegroundColor = ConsoleColor.Yellow
|
||||||
|
Console.Write("adatlap ")
|
||||||
|
Console.ForegroundColor = ConsoleColor.Gray
|
||||||
|
Console.Write("<tanulo/gondviselo>")
|
||||||
|
Console.WriteLine(vbtab + " - Adatlap lekérése")
|
||||||
|
Console.WriteLine()
|
||||||
|
Console.ForegroundColor = ConsoleColor.yellow
|
||||||
|
Console.write("changelog")
|
||||||
|
Console.ForegroundColor = ConsoleColor.Gray
|
||||||
|
Console.WriteLine(vbtab + " - Verzióváltások")
|
||||||
|
Console.WriteLine()
|
||||||
|
Console.ForegroundColor = ConsoleColor.yellow
|
||||||
|
Console.write("privacy")
|
||||||
|
Console.ForegroundColor = ConsoleColor.Gray
|
||||||
|
Console.WriteLine(vbtab + " - Adatvédelmi cucc (idk mi a neve)")
|
||||||
|
Console.WriteLine()
|
||||||
|
Elseif args.Length > 0 andalso args(0) = "adatlap" Then
|
||||||
|
if args.Length > 1 Then
|
||||||
|
if args(1) = "tanulo" Then
|
||||||
|
TanuloiAdatlap().Wait()
|
||||||
|
elseif args(1) = "gondviselo" Then
|
||||||
|
Console.WriteLine("Ha tanulói fiókkal vagy ez nagy eséllyel nem fog menni." + vbcrlf)
|
||||||
|
GondviseloiAdatlap().wait()
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Ismeretlen paraméter! (adatlap <tanulo/gondviselo>)")
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Nincs elég paraméter! (adatlap <tanulo/gondviselo>)")
|
||||||
|
End If
|
||||||
|
elseif args.Length > 0 andalso args(0) = "changelog" then
|
||||||
|
Console.WriteLine(Readonlymodule.Changelog)
|
||||||
|
elseif args.Length > 0 andalso args(0) = "privacy" Then
|
||||||
|
Console.WriteLine(Readonlymodule.Privacy)
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Ismeretlen parancs, kérlek használd a segítséget. (help)")
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function GetSchools(search As String) As Task
|
||||||
|
Dim task As Task = Task.Run(
|
||||||
|
Sub()
|
||||||
|
dim path as string = GetStartupPath() + "schools.json"
|
||||||
|
Dim lastWriteTime As DateTime = File.GetLastWriteTime(path)
|
||||||
|
Dim timediff As TimeSpan = DateTime.Now.Subtract(lastWriteTime)
|
||||||
|
If File.Exists(path) AndAlso timediff.TotalHours < 10 AndAlso Not timediff.TotalHours < 0 Then
|
||||||
|
Dim schools As String = File.ReadAllText(path)
|
||||||
|
Console.ForegroundColor = ConsoleColor.DarkGreen
|
||||||
|
Console.WriteLine("Volt egy már cachelt változat, ami {0} órája volt letöltve.",
|
||||||
|
timediff.TotalHours.ToString("0.0"))
|
||||||
|
Console.ForegroundColor = ConsoleColor.Gray
|
||||||
|
Dim sarray = ""
|
||||||
|
Dim searchIndex As Integer = schools.ToLower.IndexOf(search.ToLower, StringComparison.Ordinal)
|
||||||
|
If searchIndex = - 1 Then
|
||||||
|
Console.WriteLine("Nincs találat, próbálj valami mást.")
|
||||||
|
Else
|
||||||
|
searchIndex = 0
|
||||||
|
Dim jArray As JArray = JArray.Parse(schools)
|
||||||
|
For Each jObject As JObject In jArray
|
||||||
|
Dim nev As String = jObject("nev").ToString().ToLower()
|
||||||
|
Dim azonosito As String = jObject("azonosito").ToString().ToLower()
|
||||||
|
Dim found = False
|
||||||
|
If nev.Contains(search.ToLower, StringComparison.CurrentCultureIgnoreCase) Then
|
||||||
|
searchIndex += 1
|
||||||
|
sarray += jObject.ToString
|
||||||
|
found = True
|
||||||
|
End If
|
||||||
|
If found = False Then
|
||||||
|
If azonosito.Contains(search.ToLower, StringComparison.CurrentCultureIgnoreCase) _
|
||||||
|
Then
|
||||||
|
searchIndex += 1
|
||||||
|
sarray += jObject.ToString
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
If searchIndex = 1 Then
|
||||||
|
Console.WriteLine(sarraygen(sarray))
|
||||||
|
Else
|
||||||
|
Dim arrays As String() = sarray.Split("}{").ToArray
|
||||||
|
Dim number = 0
|
||||||
|
For Each sarray In arrays
|
||||||
|
number += 1
|
||||||
|
Console.WriteLine(vbCrLf + "{0}. Találat", number.ToString)
|
||||||
|
Console.WriteLine(sarraygen(sarray))
|
||||||
|
Next
|
||||||
|
Console.WriteLine(vbCrLf)
|
||||||
|
Console.WriteLine("A parancs 1-nél több iskolát ({0}) talált.", number.ToString)
|
||||||
|
Console.WriteLine("Ha lehet kicsit specifikusabban add meg a nevét!")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Dim client = New HttpClient()
|
||||||
|
client.DefaultRequestHeaders.Add("api-version", "v1")
|
||||||
|
Dim response As HttpResponseMessage =
|
||||||
|
client.GetAsync("https://kretaglobalapi.e-kreta.hu/intezmenyek/kreta/publikus").Result
|
||||||
|
If response.IsSuccessStatusCode Then
|
||||||
|
Dim schools As String = response.Content.ReadAsStringAsync().Result
|
||||||
|
File.Delete(path)
|
||||||
|
File.WriteAllText(path, schools)
|
||||||
|
Dim sarray = ""
|
||||||
|
Dim searchIndex As Integer = schools.ToLower.IndexOf(search.ToLower,
|
||||||
|
StringComparison.Ordinal)
|
||||||
|
If searchIndex = - 1 Then
|
||||||
|
Console.WriteLine("Nincs találat, próbálj valami mást.")
|
||||||
|
Else
|
||||||
|
searchIndex = 0
|
||||||
|
Dim jArray As JArray = JArray.Parse(schools)
|
||||||
|
For Each jObject As JObject In jArray
|
||||||
|
Dim nev As String = jObject("nev").ToString().ToLower()
|
||||||
|
Dim azonosito As String = jObject("azonosito").ToString().ToLower()
|
||||||
|
Dim found = False
|
||||||
|
If nev.Contains(search.ToLower, StringComparison.CurrentCultureIgnoreCase) Then
|
||||||
|
searchIndex += 1
|
||||||
|
sarray += jObject.ToString
|
||||||
|
found = True
|
||||||
|
End If
|
||||||
|
If found = False Then
|
||||||
|
If azonosito.Contains(search.ToLower, StringComparison.CurrentCultureIgnoreCase) _
|
||||||
|
Then
|
||||||
|
searchIndex += 1
|
||||||
|
sarray += jObject.ToString
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
If searchIndex = 1 Then
|
||||||
|
Console.WriteLine(sarraygen(sarray))
|
||||||
|
Else
|
||||||
|
Dim arrays As String() = sarray.Split("}{").ToArray
|
||||||
|
Dim number = 0
|
||||||
|
For Each sarray In arrays
|
||||||
|
number += 1
|
||||||
|
Console.WriteLine(vbCrLf + "{0}. Találat", number.ToString)
|
||||||
|
Console.WriteLine(sarraygen(sarray.ToString()))
|
||||||
|
Next
|
||||||
|
Console.WriteLine(vbCrLf)
|
||||||
|
Console.WriteLine("A parancs 1-nél több iskolát ({0}) talált.", number.ToString)
|
||||||
|
Console.WriteLine("Ha lehet kicsit specifikusabban add meg a nevét!")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Hiba, {0}", response.StatusCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
End Sub)
|
||||||
|
Return task
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function SarrayGen(stringarray As String)
|
||||||
|
Dim str As String = stringarray.Replace(" ", "").Replace(": ", ":")
|
||||||
|
dim list
|
||||||
|
if RuntimeInformation.IsOSPlatform(OSPlatform.Windows) then
|
||||||
|
list = New List(Of String)(str.Split(New String() {vbCrLf}, StringSplitOptions.None))
|
||||||
|
Else
|
||||||
|
list = New List(Of String)(str.Split(New String() {vbLf}, StringSplitOptions.None))
|
||||||
|
end if
|
||||||
|
dim azonosito as string =
|
||||||
|
list.Item(2).Replace("""azonosito"":""", "Azonosító: ").Replace(""",", "").Replace(vbCrLf, "").
|
||||||
|
ToString
|
||||||
|
dim nev as String =
|
||||||
|
list.Item(3).Replace("""nev"":""", "Név: ").Replace(""",", "").Replace(vbCrLf, "").ToString
|
||||||
|
If nev.Contains("\""") Then
|
||||||
|
nev = nev.Replace("\""", "")
|
||||||
|
End If
|
||||||
|
dim link as String =
|
||||||
|
list.Item(6).Replace("""kretaLink"":""", "Link: ").Replace(""",", "").Replace(vbCrLf, "").ToString
|
||||||
|
Dim final As String = vbCrLf + azonosito + vbCrLf + nev + vbCrLf + link
|
||||||
|
Return final
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function GetNonce()
|
||||||
|
Dim nonce = ""
|
||||||
|
Dim client = New HttpClient()
|
||||||
|
Dim response As HttpResponseMessage = client.GetAsync("https://idp.e-kreta.hu/nonce").Result
|
||||||
|
If response.IsSuccessStatusCode Then
|
||||||
|
nonce = response.Content.ReadAsStringAsync().Result
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Hiba, {0}", response.StatusCode)
|
||||||
|
End If
|
||||||
|
Return nonce
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function GetStartupPath() As String
|
||||||
|
dim path as string = IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
|
||||||
|
if RuntimeInformation.IsOSPlatform(OSPlatform.Windows) Then
|
||||||
|
path = path + "\"
|
||||||
|
Else
|
||||||
|
path = path + "/"
|
||||||
|
End if
|
||||||
|
Return path
|
||||||
|
End Function
|
||||||
|
' megfogom ölni magam
|
||||||
|
Private Function GetBearer(username As String, password As String, instituteCode As String) As Task
|
||||||
|
Dim task As Task = Task.Run(
|
||||||
|
Sub()
|
||||||
|
Dim client = New HttpClient()
|
||||||
|
Dim nonce As String = getNonce()
|
||||||
|
Dim authpoolkey As String = GenAuthorizationPolicy(username, institutecode, nonce)
|
||||||
|
Dim content = New FormUrlEncodedContent(New Dictionary(Of String, String) From {
|
||||||
|
{"userName", username},
|
||||||
|
{"password", password},
|
||||||
|
{"institute_code", institutecode},
|
||||||
|
{"grant_type", "password"},
|
||||||
|
{"client_id", "kreta-ellenorzo-mobile-android"}
|
||||||
|
})
|
||||||
|
client.DefaultRequestHeaders.Add("X-Authorizationpolicy-Key", authpoolkey)
|
||||||
|
client.DefaultRequestHeaders.Add("X-Authorizationpolicy-Version", "v2")
|
||||||
|
client.DefaultRequestHeaders.Add("X-Authorizationpolicy-Nonce", nonce)
|
||||||
|
Dim response As HttpResponseMessage =
|
||||||
|
client.PostAsync("https://idp.e-kreta.hu/connect/token", content).Result
|
||||||
|
If response.IsSuccessStatusCode Then
|
||||||
|
Dim result As String = response.Content.ReadAsStringAsync.Result
|
||||||
|
Console.WriteLine("Sikeres lekérés mentve.")
|
||||||
|
Try
|
||||||
|
Dim path As String = GetStartupPath() + "login.json"
|
||||||
|
File.Delete(path)
|
||||||
|
File.WriteAllText(path, result)
|
||||||
|
path = GetStartupPath() + "loginData.json"
|
||||||
|
File.Delete(path)
|
||||||
|
Dim jObject As JObject = JObject.Parse(result)
|
||||||
|
Dim token As String = jObject("access_token").ToString()
|
||||||
|
Dim refreshToken As String = jObject("refresh_token").ToString()
|
||||||
|
Dim json As String = "{""access_token"":""" + token + """," + vbCrLf + """refresh_token"":""" +
|
||||||
|
refreshToken + """," + vbCrLf + """institute_code"":""" + instituteCode +
|
||||||
|
"""}"
|
||||||
|
File.WriteAllText(path, json)
|
||||||
|
File.Delete(GetStartupPath() + "login.json")
|
||||||
|
Catch ex As Exception
|
||||||
|
Console.WriteLine("Hiba történt a mentés során.")
|
||||||
|
Exit Try
|
||||||
|
End Try
|
||||||
|
Console.WriteLine("Adatok elmentve!")
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Hiba, {0}", response.StatusCode)
|
||||||
|
Console.WriteLine("{0}", response.Content.ReadAsStringAsync().Result)
|
||||||
|
End If
|
||||||
|
End Sub)
|
||||||
|
Return task
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function GenAuthorizationPolicy(username As String, institutecode As String, nonce As String)
|
||||||
|
Const hmacKey = "baSsxOwlU1jM"
|
||||||
|
Dim hmac = New HMACSHA512(Encoding.UTF8.GetBytes(hmacKey))
|
||||||
|
Dim unenc As String = institutecode.ToUpper + nonce + username.ToUpper
|
||||||
|
Dim enc As Byte() = hmac.ComputeHash(Encoding.UTF8.GetBytes(unenc))
|
||||||
|
Dim base64 As String = Convert.ToBase64String(enc)
|
||||||
|
Return base64
|
||||||
|
End Function
|
||||||
|
|
||||||
|
private function TanuloiAdatlap() as task
|
||||||
|
dim task as task = task.run(Sub()
|
||||||
|
Dim lastWriteTime As DateTime = File.GetLastWriteTime(getstartuppath + "diakadatlap.json")
|
||||||
|
Dim timediff As TimeSpan = DateTime.Now.Subtract(lastWriteTime)
|
||||||
|
if _
|
||||||
|
File.Exists(getstartuppath + "diakadatlap.json") AndAlso timediff.TotalHours < 10 AndAlso
|
||||||
|
Not timediff.TotalHours < 0 Then
|
||||||
|
Dim diakadatlap As String = File.ReadAllText(getstartuppath + "diakadatlap.json")
|
||||||
|
Console.ForegroundColor = ConsoleColor.DarkGreen
|
||||||
|
Console.WriteLine("Volt egy már cachelt változat, ami {0} órája volt letöltve.",
|
||||||
|
timediff.TotalHours.ToString("0.0"))
|
||||||
|
Console.ForegroundColor = ConsoleColor.Gray
|
||||||
|
Console.WriteLine(diakadatlap)
|
||||||
|
Else
|
||||||
|
dim client = new HttpClient()
|
||||||
|
dim apikey = "21ff6c25-d1da-4a68-a811-c881a6057463"
|
||||||
|
client.DefaultRequestHeaders.Add("apiKey", apikey)
|
||||||
|
dim path as string = GetStartupPath() + "loginData.json"
|
||||||
|
dim token as string
|
||||||
|
dim school as string
|
||||||
|
if File.Exists(path) Then
|
||||||
|
dim jsonString as string = file.ReadAllText(path)
|
||||||
|
dim jsonObject as JObject = JObject.Parse(jsonString)
|
||||||
|
token = jsonObject("access_token").ToString()
|
||||||
|
school = jsonObject("institute_code").ToString()
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Jelenleg nem vagy authentikálva / nem található a loginData.json fájl.")
|
||||||
|
Console.WriteLine("Kérlek használd az auth parancsot.")
|
||||||
|
exit sub
|
||||||
|
End If
|
||||||
|
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token)
|
||||||
|
dim response as HttpResponseMessage =
|
||||||
|
client.GetAsync("https://" + school + ".e-kreta.hu/ellenorzo/v3/sajat/TanuloAdatlap").Result
|
||||||
|
if response.IsSuccessStatusCode Then
|
||||||
|
dim savepath as string = getstartuppath + "diakadatlap.json"
|
||||||
|
Dim result As String = response.Content.ReadAsStringAsync.Result
|
||||||
|
File.Delete(savepath)
|
||||||
|
File.WriteAllText(savepath, result)
|
||||||
|
Console.WriteLine(result)
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Hiba, {0}", response.StatusCode)
|
||||||
|
Console.WriteLine("{0}", response.Content.ReadAsStringAsync().Result)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
end sub)
|
||||||
|
return task
|
||||||
|
End function
|
||||||
|
|
||||||
|
private function GondviseloiAdatlap() as task
|
||||||
|
dim task as task = task.run(Sub()
|
||||||
|
Dim lastWriteTime As DateTime = File.GetLastWriteTime(getstartuppath + "szuloadatlap.json")
|
||||||
|
Dim timediff As TimeSpan = DateTime.Now.Subtract(lastWriteTime)
|
||||||
|
if file.Exists(getstartuppath + "szuloadatlap.json") AndAlso timediff.TotalHours < 10 AndAlso
|
||||||
|
Not timediff.TotalHours < 0 Then
|
||||||
|
dim szuloadatlap as string = file.ReadAllText(getstartuppath + "szuloadatlap.json")
|
||||||
|
Console.ForegroundColor = ConsoleColor.DarkGreen
|
||||||
|
Console.WriteLine("Volt egy már cachelt változat, ami {0} órája volt letöltve.",
|
||||||
|
timediff.TotalHours.ToString("0.0"))
|
||||||
|
Console.ForegroundColor = ConsoleColor.Gray
|
||||||
|
Console.WriteLine(szuloadatlap)
|
||||||
|
Else
|
||||||
|
dim client = new HttpClient()
|
||||||
|
dim apikey = "21ff6c25-d1da-4a68-a811-c881a6057463"
|
||||||
|
client.DefaultRequestHeaders.Add("apiKey", apikey)
|
||||||
|
dim path as string = GetStartupPath() + "loginData.json"
|
||||||
|
dim token as string
|
||||||
|
dim school as string
|
||||||
|
if File.Exists(path) Then
|
||||||
|
dim jsonString as string = file.ReadAllText(path)
|
||||||
|
dim jsonObject as JObject = JObject.Parse(jsonString)
|
||||||
|
token = jsonObject("access_token").ToString()
|
||||||
|
school = jsonObject("institute_code").ToString()
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Jelenleg nem vagy authentikálva / nem található a loginData.json fájl.")
|
||||||
|
Console.WriteLine("Kérlek használd az auth parancsot.")
|
||||||
|
exit sub
|
||||||
|
End If
|
||||||
|
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token)
|
||||||
|
dim response as HttpResponseMessage =
|
||||||
|
client.GetAsync("https://" + school + ".e-kreta.hu/ellenorzo/v3/sajat/GondviseloAdatlap").Result
|
||||||
|
if response.IsSuccessStatusCode Then
|
||||||
|
dim savepath as string = getstartuppath + "szuloadatlap.json"
|
||||||
|
Dim result As String = response.Content.ReadAsStringAsync.Result
|
||||||
|
File.Delete(savepath)
|
||||||
|
File.WriteAllText(savepath, result)
|
||||||
|
Console.WriteLine(result)
|
||||||
|
Else
|
||||||
|
if response.StatusCode.ToString() = "Forbidden" Then
|
||||||
|
Console.WriteLine("Használj inkább tanulói adatlapot! (adatlap tanulo)")
|
||||||
|
End If
|
||||||
|
Console.WriteLine("Hiba, {0}", response.StatusCode)
|
||||||
|
Console.WriteLine("{0}", response.Content.ReadAsStringAsync().Result)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
end sub)
|
||||||
|
return task
|
||||||
|
End function
|
||||||
|
|
||||||
|
private function AuthRefreshToken() as task
|
||||||
|
dim task as task = Task.run(
|
||||||
|
Sub()
|
||||||
|
dim client = new HttpClient()
|
||||||
|
dim path as string = GetStartupPath() + "loginData.json"
|
||||||
|
dim refreshtok as string
|
||||||
|
dim institutecode as string
|
||||||
|
if File.Exists(path) Then
|
||||||
|
dim jsonString as string = file.ReadAllText(path)
|
||||||
|
dim jsonObject as JObject = JObject.Parse(jsonString)
|
||||||
|
refreshtok = jsonObject("refresh_token").ToString()
|
||||||
|
institutecode = jsonObject("institute_code").ToString()
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Nem voltál authentikálva / nem található a loginData.json fájl.")
|
||||||
|
Console.WriteLine("Kérlek használd az auth parancsot.")
|
||||||
|
exit sub
|
||||||
|
End If
|
||||||
|
Dim content = New FormUrlEncodedContent(New Dictionary(Of String, String) From {
|
||||||
|
{"institute_code", institutecode},
|
||||||
|
{"refresh_token", refreshtok},
|
||||||
|
{"grant_type", "refresh_token"},
|
||||||
|
{"client_id", "kreta-ellenorzo-mobile-android"}
|
||||||
|
})
|
||||||
|
dim response as HttpResponseMessage =
|
||||||
|
client.PostAsync("https://idp.e-kreta.hu/connect/token", content).Result
|
||||||
|
If response.IsSuccessStatusCode Then
|
||||||
|
Dim result As String = response.Content.ReadAsStringAsync.Result
|
||||||
|
Console.WriteLine("Sikeres lekérés mentve.")
|
||||||
|
Try
|
||||||
|
path = GetStartupPath() + "login.json"
|
||||||
|
File.Delete(path)
|
||||||
|
File.WriteAllText(path, result)
|
||||||
|
path = GetStartupPath() + "loginData.json"
|
||||||
|
File.Delete(path)
|
||||||
|
Dim jObject As JObject = JObject.Parse(result)
|
||||||
|
Dim token As String = jObject("access_token").ToString()
|
||||||
|
Dim refreshToken As String = jObject("refresh_token").ToString()
|
||||||
|
Dim json As String = "{""access_token"":""" + token + """," + vbCrLf + """refresh_token"":""" +
|
||||||
|
refreshToken + """," + vbCrLf + """institute_code"":""" + instituteCode +
|
||||||
|
"""}"
|
||||||
|
File.WriteAllText(path, json)
|
||||||
|
file.Delete(GetStartupPath() + "login.json")
|
||||||
|
Catch ex As Exception
|
||||||
|
Console.WriteLine("Hiba történt a mentés során.")
|
||||||
|
Exit Try
|
||||||
|
End Try
|
||||||
|
Console.WriteLine("Adatok elmentve!")
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Hiba, {0}", response.StatusCode)
|
||||||
|
Console.WriteLine("{0}", response.Content.ReadAsStringAsync().Result)
|
||||||
|
End If
|
||||||
|
end sub)
|
||||||
|
return task
|
||||||
|
End function
|
||||||
|
|
||||||
|
private Function ReadPassword() As String
|
||||||
|
Dim password As New System.Text.StringBuilder()
|
||||||
|
While True
|
||||||
|
Dim info As ConsoleKeyInfo = Console.ReadKey(True)
|
||||||
|
If info.Key = ConsoleKey.Enter Then
|
||||||
|
Console.WriteLine()
|
||||||
|
Exit While
|
||||||
|
ElseIf info.Key = ConsoleKey.Backspace Then
|
||||||
|
If password.Length > 0 Then
|
||||||
|
password.Remove(password.Length - 1, 1)
|
||||||
|
Console.Write(vbBack)
|
||||||
|
Console.Write(" ")
|
||||||
|
Console.Write(vbBack)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
password.Append(info.KeyChar)
|
||||||
|
Console.Write("*")
|
||||||
|
End If
|
||||||
|
End While
|
||||||
|
Return password.ToString()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
private function RevokeRefreshToken() as Task
|
||||||
|
dim task as task = task.run(
|
||||||
|
Sub()
|
||||||
|
dim client = new HttpClient()
|
||||||
|
dim path as string = GetStartupPath() + "loginData.json"
|
||||||
|
dim refreshtok as string
|
||||||
|
if File.Exists(path) Then
|
||||||
|
dim jsonString as string = file.ReadAllText(path)
|
||||||
|
dim jsonObject as JObject = JObject.Parse(jsonString)
|
||||||
|
refreshtok = jsonObject("refresh_token").ToString()
|
||||||
|
Else
|
||||||
|
exit sub
|
||||||
|
End If
|
||||||
|
Dim content = New FormUrlEncodedContent(New Dictionary(Of String, String) From {
|
||||||
|
{"token", refreshtok},
|
||||||
|
{"client_id", "kreta-ellenorzo-mobile-android"}
|
||||||
|
})
|
||||||
|
dim response as HttpResponseMessage =
|
||||||
|
client.PostAsync("https://idp.e-kreta.hu/connect/revocation", content).Result
|
||||||
|
If response.IsSuccessStatusCode Then
|
||||||
|
Console.WriteLine("Refresh token érvénytelenítve.")
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Hiba, {0}", response.StatusCode)
|
||||||
|
Console.WriteLine("{0}", response.Content.ReadAsStringAsync().Result)
|
||||||
|
End If
|
||||||
|
end sub)
|
||||||
|
return task
|
||||||
|
End function
|
||||||
|
End Module
|
29
KretaCLI/readonlymodule.vb
Normal file
29
KretaCLI/readonlymodule.vb
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
Module Readonlymodule
|
||||||
|
Public ReadOnly Version as string = "1.3"
|
||||||
|
|
||||||
|
' lejebb = újabb
|
||||||
|
Public ReadOnly _
|
||||||
|
Changelog as string = "innentől van changelog baszomaszád" + vbcrlf + vbcrlf + "1.1" + vbcrlf +
|
||||||
|
"+ Kijelentkezés" +
|
||||||
|
vbCrlf +
|
||||||
|
"+ Bejelentkezést lefrissítő rendszer" +
|
||||||
|
vbcrlf +
|
||||||
|
"+ login.json törlő" + vbcrlf + "+ Adatlap lekérő" + vbcrlf + vbcrlf + "1.2" + vbcrlf +
|
||||||
|
"+ Jelszó elrejtés bejelentkezésnél" + vbcrlf + "+ user@host felállás bejelentkezésnél" +
|
||||||
|
vbcrlf + vbcrlf + "1.3" + vbcrlf + "+ Refresh token érvénytelenítés kijelentkezésnél"
|
||||||
|
|
||||||
|
public ReadOnly Privacy as string = "Az adataid védelme a te kezedben van és sorsuk rajtad múlik." + vbCrLf +
|
||||||
|
"Ha ellopják vagy bármi történik vele és rossz kezekbe kerül az a te problémád." +
|
||||||
|
vbcrlf +
|
||||||
|
"Ez a program nem táról / küld el semmilyen adatot se." + vbcrlf +
|
||||||
|
"Ha a Kréta rossz kezekbe kerül, akkor a Krétát hibáztasd. (Már volt rá példa)" +
|
||||||
|
vbtab +
|
||||||
|
"Ettől eltekintve mégis erőltetik a Krétát, mert állami" + vbcrlf + vbcrlf +
|
||||||
|
"Az alkalmazás a Kréta szerverek és a te géped között dobálja az adatokat, titkosítással. (https (legalább erre futotta az állami támogatás, mármint a Krétának))" +
|
||||||
|
vbcrlf +
|
||||||
|
"Kréta adatkezelési tájékoztató: https://tudasbazis.ekreta.hu/pages/viewpage.action?pageId=4065038" +
|
||||||
|
vbcrlf + vbcrlf + "Ez a szépséges alkalmazás nem gyűjt használati adatot." +
|
||||||
|
vbcrlf +
|
||||||
|
"+ Ha összeomlik nincs hibajelentés úgyhogy majd valahogy bejelented. (igen basztam ilyet csinálni)" +
|
||||||
|
vbcrlf + "Kérdésed van vagy kő a szórsz? contact@balazsmanus.hu"
|
||||||
|
End Module
|
4
README.md
Normal file
4
README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# KrétaCLI
|
||||||
|

|
||||||
|
|
||||||
|
VB.NET-be íródott, szóval a leghülyébb embernek is értenie kell a kódot.
|
12
build.bat
Normal file
12
build.bat
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
@echo off
|
||||||
|
rmdir /s /q "KretaCLI\bin\Release\net8.0\"
|
||||||
|
|
||||||
|
dotnet publish --no-dependencies --self-contained true --os linux
|
||||||
|
dotnet publish --no-dependencies --self-contained true --os win
|
||||||
|
|
||||||
|
del /q build\*
|
||||||
|
rmdir /s /q build
|
||||||
|
mkdir build
|
||||||
|
|
||||||
|
tar -cf build\linux-x64.zip -C KretaCLI\bin\Release\net8.0\linux-x64\publish .
|
||||||
|
tar -cf build\win-x64.zip -C KretaCLI\bin\Release\net8.0\win-x64\publish .
|
17
build.sh
Normal file
17
build.sh
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# clean (delete) folders before build
|
||||||
|
rm -r KretaCLI/bin/Release/net8.0/
|
||||||
|
|
||||||
|
# make packages with dotnet8 preinstalled
|
||||||
|
# those will be x64 only and they will be put into the publish folder under the platform name
|
||||||
|
dotnet publish --no-dependencies --self-contained true --os linux
|
||||||
|
dotnet publish --no-dependencies --self-contained true --os win
|
||||||
|
|
||||||
|
# remake build folder
|
||||||
|
rm -r build/
|
||||||
|
mkdir build
|
||||||
|
|
||||||
|
# zip em'
|
||||||
|
zip -r build/linux-x64.zip KretaCLI/bin/Release/net8.0/linux-x64/publish/
|
||||||
|
zip -r build/win-x64.zip KretaCLI/bin/Release/net8.0/win-x64/publish/
|
59
docs/index.html
Normal file
59
docs/index.html
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>KrétaCLI</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<style>
|
||||||
|
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap');
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'JetBrains Mono', monospace;
|
||||||
|
background-color: #222222;
|
||||||
|
color: #cccccc;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-khtml-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
white-space: pre;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div style="display: flex;justify-content: center;">
|
||||||
|
<div style="text-align: center; max-width: 705px;">
|
||||||
|
<pre style="white-space: pre;">
|
||||||
|
<code> =@@@@@@@@@@
|
||||||
|
-@@@@@@@%
|
||||||
|
=@@@@@@:
|
||||||
|
.@@@@@-
|
||||||
|
@@@
|
||||||
|
|
||||||
|
@@@@@ =@@@@@@@:@@@@@@@@@@@@== @@@@@@@@@@@@@@@=@@@@@@@@@@@@@@@@@@= =@@
|
||||||
|
@@@@@ -@@@@@@*- @@@@@@@@@@@@@@%- @@@@@@@@@@@@@@@=@@@@@@@@@@@@@@@@@@= *@@@@-
|
||||||
|
@@@@@ #@@@@@@# @@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@=@@@@@@@@@@@@@@@@@@= @@@@@@@:
|
||||||
|
@@@@@*@@@@@@*- @@@@@@ .@@@@@* @@@@@ =@@@@@ %@@@@@@@%
|
||||||
|
@@@@@@@@@@@: @@@@@@ =#@@@@@= @@@@@========= =@@@@@ @@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@- @@@@@@@@@@@@@@@* @@@@@@@@@@@@@@ =@@@@@ .@@@@@@%@@@@@@-
|
||||||
|
@@@@@@@@@@@@= @@@@@@@@@@@@@@: @@@@@@@@@@@@@@ =@@@@@ #@@@@@@ =@@@@@@:
|
||||||
|
@@@@@*-*@@@@@* @@@@@@-*@@@@@- @@@@@--------- =@@@@@ *@@@@@* -@@@@@*
|
||||||
|
@@@@@ *@@@@@% @@@@@@ @@@@@@- @@@@@ =@@@@@ -@@@@@% -@@@@@*
|
||||||
|
@@@@@ =@@@@@@ @@@@@@ @@@@@@ @@@@@@@@@@@@@@@= =@@@@@ :@@@@@@: =@@@@@@
|
||||||
|
@@@@@ %@@@@@* @@@@@@ %@@@@@ @@@@@@@@@@@@@@@= =@@@@@ %@@@@@- *@@@@@*
|
||||||
|
@@@@@ :@@@@@@=@@@@@@ :@@@@@@ @@@@@@@@@@@@@@@= =@@@@@ @@@@@@ =@@@@@
|
||||||
|
|
||||||
|
=@@
|
||||||
|
*@@@@-
|
||||||
|
=@@@@@@:
|
||||||
|
-@@@@@@@% </code>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
Add table
Add a link
Reference in a new issue