This repository was archived by the owner on May 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
3,319 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
||
target/ | ||
.settings/ | ||
.vscode/ | ||
.classpath | ||
.project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,48 @@ | ||
# ePorezi | ||
Декомпајлирана апликација за eПорезе са подршком за Linux, MacOS, Windows и JDK11 | ||
|
||
Aпликација [еПорези](http://www.poreskauprava.gov.rs/sr/e-porezi/portal.html) са одличним [grakic-евим модификацијама](https://gist.github.com/grakic/32af1e15ec626cae1e5e17e3c146c486) како би радила на Linux/MacOS-у и додатним преправкама како би радила на новим верзијама Јаве. | ||
|
||
# Requirements (Ubuntu 18.04) | ||
* openjdk11 (било који >= 8 би требало да ради) | ||
* [Поштин SafeSign](https://www.ca.posta.rs/preuzimanje_softvera.htm) | ||
* [libgdbm3](https://packages.ubuntu.com/xenial/amd64/libgdbm3/download) (обрисан из стандардних репозиторијума) | ||
* Поштин сертификат (MУП-ов са личних карти ради само на Windows и [од скоро MacOS](https://nikola.milojevic.me/blog/eporezi-macos-mup/) системима, види [овде](http://zverko.rs/2015/01/sta-je-to-elektronski-potpis-kako-se-koristi-i-kako-instalirati-to-cudo/) за више информација и проблематику). | ||
* Ако пријављује да не види картицу, погледати секцију Могући проблеми [овде](http://jfreesteel.devbase.net/program/ubuntu/#accordionP). | ||
|
||
Корисно је прочитати grakic-eв gist за [Линукс](https://gist.github.com/grakic/32af1e15ec626cae1e5e17e3c146c486)/[MacOS](https://gist.github.com/grakic/9a850411c3b9294ff0c226e4f914be35), будући да је у њему све лепо описано. | ||
|
||
Windows корисници у теорији могу да drop-in замене `ePorezi.jar` из `Program Files` са оним билдованим одавде. | ||
|
||
# Build | ||
Неопходно је да имате инсталиран `maven` | ||
```bash | ||
git clone https://github.com/lazanet/ePorezi.git | ||
cd ePorezi | ||
mvn clean package | ||
``` | ||
|
||
# Run | ||
```bash | ||
cd ePorezi/target | ||
java -jar ePorezi-1.0.jar | ||
``` | ||
|
||
# Install (Ubuntu 18.04) | ||
```bash | ||
cd ePorezi | ||
sudo mkdir -p /opt/ePorezi | ||
sudo cp target/ePorezi-1.0.jar /opt/ePorezi/ePorezi.jar | ||
sudo cp launcher/* /opt/ePorezi/ | ||
sudo ln -s /opt/ePorezi/ePorezi.desktop /usr/share/applications/ePorezi.desktop | ||
``` | ||
|
||
# License | ||
Будући да је ово неофицијелна апликација, користите је на сопствену одговорност (иако не би требало да буде икаквих проблема јер је сав промењен код само замена API-јева). Изворни код је добијен тривијалним позивом јавног [fernflower декомпајлера](https://the.bytecode.club/fernflower.jar) са јавном апликацијом еПорези, и служи само како би омогућио корисницима овог система од јавног интереса боље услове за рад (а све због некомпетентности оригиналних аутора). | ||
|
||
Сваки PR, било за документовање било за додавање фичра је добродошао. | ||
TODO листа изгледа отприлике овако: | ||
* ребазирати печеве на еПорези 1.1 верзију | ||
* средити build систем да генеришe `.exe` / `.deb` / `.dmg` | ||
* написати крштено упутство за кориснике MacOS / Windows-a | ||
* декомпајлирати `libnstpkcs11.so` Ghidra-ом и пробати прављење 64-битног билда. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5"> | ||
<output url="file://$MODULE_DIR$/target/classes" /> | ||
<output-test url="file://$MODULE_DIR$/target/test-classes" /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> | ||
<excludeFolder url="file://$MODULE_DIR$/target" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
if type -p java > /dev/null; then | ||
echo found java executable in PATH | ||
JAVA_PATH=java | ||
elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then | ||
echo found java executable in JAVA_HOME | ||
JAVA_PATH="$JAVA_HOME/bin/java" | ||
fi | ||
|
||
if ! check_java_version "$JAVA_PATH" $JAVA_TARGET; then | ||
|
||
echo looking for java alternatives | ||
|
||
JAVA_ALTERNATIVES=`update-alternatives --list java`; | ||
JAVA_ALTERNATIVE_FOUND=0 | ||
|
||
for JAVA_PATH in $JAVA_ALTERNATIVES; do | ||
JAVA_ALTERNATIVE_FOUND=1 | ||
break; | ||
done | ||
|
||
if [[ JAVA_ALTERNATIVE_FOUND -eq 0 ]]; then | ||
zenity --error --text="Java nije pronađena. Aplikacija ne može biti pokrenuta." | ||
exit; | ||
fi | ||
|
||
fi | ||
|
||
echo using java command $JAVA_PATH | ||
|
||
$JAVA_PATH -jar /opt/ePorezi/ePorezi*.jar $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[Desktop Entry] | ||
Name=ePorezi | ||
Exec=/opt/ePorezi/ePorezi %u | ||
Icon=/opt/ePorezi/ePorezi.png | ||
Type=Application | ||
Terminal=false | ||
MimeType=x-scheme-handler/eporezi; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>rs.gov.poreskauprava</groupId> | ||
<artifactId>ePorezi</artifactId> | ||
<version>1.0</version> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
<configuration> | ||
<source>8</source> | ||
<target>8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>2.5</version> | ||
<configuration> | ||
<archive> | ||
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
package com.itsinbox.smartbox; | ||
|
||
import com.itsinbox.smartbox.gui.LoginFrame; | ||
import com.itsinbox.smartbox.gui.SignXmlFrame; | ||
import com.itsinbox.smartbox.utils.Utils; | ||
import java.awt.Component; | ||
import java.net.URLDecoder; | ||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
import javax.swing.JOptionPane; | ||
import javax.swing.UIManager; | ||
import javax.swing.UnsupportedLookAndFeelException; | ||
|
||
public class SmartBox { | ||
|
||
public static final String VERSION = "1.0"; | ||
public static final String ITO_BASE_URL = "http://10.1.65.31"; | ||
public static final String ETO_BASE_URL = "http://test.purs.gov.rs"; | ||
public static final String TEST_BASE_URL = "http://test.purs.gov.rs"; | ||
public static final String PRODUCTION_BASE_URL = "http://eporezi.purs.gov.rs"; | ||
public static final String VERSION_CHECK_URL = "http://eporezi.purs.gov.rs/upload/eporezi/version"; | ||
public static final String APP_DOWNLOAD_BASE_URL = "http://eporezi.purs.gov.rs/upload/eporezi/eporezi_setup_v"; | ||
public static final String LOG_FILE_NAME = "eporezi.log"; | ||
public static final String NOTIFICATION_ENVIRNOMENT_NOT_DETECTED = "Грешка приликом читања параметара."; | ||
public static final String NOTIFICATION_LOGGING_IN = "Приступање порталу еПорези..."; | ||
public static final String NOTIFICATION_LOGGING_IN_TEST = "Приступање Тестном окружењу..."; | ||
public static final String NOTIFICATION_NO_READER = "Читач картица није пронађен."; | ||
public static final String NOTIFICATION_NO_CARD = "Картица није пронађена. Молим, убаците картицу у читач."; | ||
public static final String NOTIFICATION_SERVER_ERROR = "Грешка у комуникацији са сервером."; | ||
public static final String NOTIFICATION_STATUS_READY = "Читач и картица препознати."; | ||
public static final String NOTIFICATION_CARD_BROKEN = "Дисфункционална картица."; | ||
public static final String NOTIFICATION_CARD_BLOCKED = "Блокирана картица."; | ||
public static final String NOTIFICATION_NO_CERT_DATA = "Дошло је до грешке приликом читања сертификата. Молим, покушајте поново."; | ||
public static final String NOTIFICATION_WRONG_PIN = "Погрешан ПИН!"; | ||
public static final String NOTIFICATION_PIN_VALID = "ПИН исправан! Учитавање..."; | ||
public static final String NOTIFICATION_INVALID_CERT = "<html>Невалидан сертификат. Обратите се вашем<br>сертификационом телу за помоћ.</html>"; | ||
public static final String WINDOW_TITLE = "еПорези "; | ||
private static SmartBox.Environment environment = SmartBox.Environment.UNKNOWN; | ||
private static String baseUrl; | ||
|
||
|
||
public static void main(String[] args) { | ||
setLaf(); | ||
if(args != null && args.length > 0) { | ||
processUrl(args[0]); | ||
} else { | ||
showLogin((String)null); | ||
} | ||
|
||
} | ||
|
||
private static void processUrl(String uri) { | ||
try { | ||
uri = uri.substring(0, uri.length() - 1); | ||
Map ex = splitQuery(uri.replace("eporezi://", "")); | ||
String env = (String)ex.get("env"); | ||
String loginKey = (String)ex.get("loginKey"); | ||
String xmlUrl = (String)ex.get("xmlUrl"); | ||
if(env == null) { | ||
environment = SmartBox.Environment.UNKNOWN; | ||
} else { | ||
byte servletUrl = -1; | ||
switch(env.hashCode()) { | ||
case 100768: | ||
if(env.equals("eto")) { | ||
servletUrl = 1; | ||
} | ||
break; | ||
case 104612: | ||
if(env.equals("ito")) { | ||
servletUrl = 2; | ||
} | ||
break; | ||
case 3449687: | ||
if(env.equals("prod")) { | ||
servletUrl = 0; | ||
} | ||
} | ||
|
||
switch(servletUrl) { | ||
case 0: | ||
environment = SmartBox.Environment.PRODUCTION; | ||
baseUrl = "http://eporezi.purs.gov.rs"; | ||
break; | ||
case 1: | ||
environment = SmartBox.Environment.ETO; | ||
baseUrl = "http://test.purs.gov.rs"; | ||
break; | ||
case 2: | ||
environment = SmartBox.Environment.ITO; | ||
baseUrl = "http://10.1.65.31"; | ||
break; | ||
default: | ||
environment = SmartBox.Environment.UNKNOWN; | ||
baseUrl = null; | ||
} | ||
} | ||
|
||
if(environment == SmartBox.Environment.UNKNOWN) { | ||
JOptionPane.showMessageDialog((Component)null, "Грешка приликом читања параметара.", "SmartBox", 0); | ||
return; | ||
} | ||
|
||
if(loginKey != null && loginKey.length() > 0) { | ||
showLogin(loginKey); | ||
} else if(xmlUrl != null && xmlUrl.length() > 0) { | ||
String reqKey = (String)ex.get("reqKey"); | ||
String servletUrl1 = decodeString((String)ex.get("servletUrl")); | ||
String backUrl = decodeString((String)ex.get("backUrl")); | ||
String jmbgAuth = decodeString((String)ex.get("jmbgAuth")); | ||
String pibAuth = decodeString((String)ex.get("pibAuth")); | ||
String taxFormId = decodeString((String)ex.get("id")); | ||
String itemId = decodeString((String)ex.get("itemId")); | ||
showSignXml(reqKey, xmlUrl, servletUrl1, backUrl, jmbgAuth, pibAuth, taxFormId, itemId); | ||
} | ||
} catch (Exception var12) { | ||
Utils.logMessage("Error while processing URL: " + var12.getMessage()); | ||
showLogin((String)null); | ||
} | ||
|
||
} | ||
|
||
private static void setLaf() { | ||
String os = System.getProperty("os.name"); | ||
os = os.toLowerCase(); | ||
Utils.logMessage("OS info: " + os); | ||
|
||
try { | ||
if(os.contains("windows")) { | ||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); | ||
} else if(os.contains("linux")) { | ||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); | ||
} else { | ||
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); | ||
} | ||
} catch (UnsupportedLookAndFeelException var2) { | ||
Utils.logMessage("Error while setting window theme: " + var2.getMessage()); | ||
} catch (IllegalAccessException e) { | ||
e.printStackTrace(); | ||
} catch (InstantiationException e) { | ||
e.printStackTrace(); | ||
} catch (ClassNotFoundException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
} | ||
|
||
private static void showLogin(String loginKey) { | ||
LoginFrame.init(environment, loginKey); | ||
} | ||
|
||
private static void showSignXml(String reqKey, String xmlUrl, String servletUrl, String backUrl, String jmbgAuth, String pibAuth, String taxFormId, String itemId) { | ||
SignXmlFrame frame = new SignXmlFrame(environment, baseUrl, reqKey, xmlUrl, servletUrl, backUrl, jmbgAuth, pibAuth, taxFormId, itemId); | ||
frame.setVisible(true); | ||
frame.init(); | ||
} | ||
|
||
private static Map splitQuery(String query) throws Exception { | ||
LinkedHashMap query_pairs = new LinkedHashMap(); | ||
String[] pairs = query.split("&"); | ||
String[] var3 = pairs; | ||
int var4 = pairs.length; | ||
|
||
for(int var5 = 0; var5 < var4; ++var5) { | ||
String pair = var3[var5]; | ||
int idx = pair.indexOf("="); | ||
query_pairs.put(URLDecoder.decode(pair.substring(0, idx), "UTF-8"), URLDecoder.decode(pair.substring(idx + 1), "UTF-8")); | ||
} | ||
|
||
return query_pairs; | ||
} | ||
|
||
private static String decodeString(String string) { | ||
try { | ||
return URLDecoder.decode(string, "UTF-8"); | ||
} catch (Exception var2) { | ||
return string; | ||
} | ||
} | ||
|
||
|
||
public static enum Environment { | ||
|
||
PRODUCTION("PRODUCTION", 0), | ||
ETO("ETO", 1), | ||
ITO("ITO", 2), | ||
UNKNOWN("UNKNOWN", 3); | ||
// $FF: synthetic field | ||
private static final SmartBox.Environment[] $VALUES = new SmartBox.Environment[]{PRODUCTION, ETO, ITO, UNKNOWN}; | ||
|
||
|
||
private Environment(String var1, int var2) {} | ||
|
||
} | ||
} |
Oops, something went wrong.