mip_sdk PDF PFILE opening in Edge - microsoft-information-protection

My intention is to encrypt a pdf file using MIP SDK on Ubuntu, later to be opened via latest version of Edge, the same way as it is working by running the PowerShell command Set-AIPFileLabel against a PDF file.
I've noticed that file_sample (version 1.8.97) is generating a pfile file once protecting a pdf file.
./file_sample --username xxx --password yyy -f File.pdf -s e34d7a96-f751-4283-b017-25605f94a6d6
New file created: File.pdf.pfile
/file_sample --username xxx --password yyy -f File.pdf.pfile -g
Something bad happened: Failed to open file, , CorrelationId=217d288a-53a8-4b13-9731-43c7bf01579b, CorrelationId.Description=FileEngine
Exiting.
After copying that pfile on Windows OS, I was not able to open it with Edge, neither with AIP viewer.
Question #1: how can I use file_sample to protect a PDF document in a way to be able to view it via Edge browser?
Question #1: How can I add custom permission with file_sample ? let say for a specific user (ex:test#domain.com) specific permission (ex: only view), similar that we can do with Powershell -> New-AIPCustomPermissions
Thank you

It's important that I state that the sample apps are not supported for production use.
With that covered, for ad hoc protection, you need to look at the --protect switch.
("p,protect", "Protect with custom permissions protection to comma-separated user list."
" or as permissions to those users", cxxopts::value())
If you remove the .pfile from the extension, can you open it in Edge? The sample app should be creating a valid PDF file, assuming the input PDF supports the IRM spec (I think PDF verison 1.7 or later).

Related

custom docker image containing nanoiis and sqlcmd utility

I would like to create an image containing nanoiis image with the sqlcmd utility installed. I could further use this custom image in our DevOps pipeline.
The sqlcmd is available at [this sqlcmd link] from the microsoft website
https://learn.microsoft.com/en-us/sql/tools/sqlcmd-utility?view=sql-server-2017.
I'm kind of stuck because the utility is in a msi file (MsSqlCmdLnUtils.msi) and I don't know how to run a software that would popup an UI unlike SQLserver that can be installed from command line.
Once done, I can commit the image and use it in our pipeline.
2 things:
Nano server does not support IIS role anymore
You can not install MSI files on nano server either
You need to base your image off windowsservercore instead and run your installation in quiet mode to avoid popups in MSI file.

ERROR: could not open file for reading: Permission denied. SQL state: 42501

I am trying to copy an existing CSV file in a SQL table in pgAdmin4 1.5.
I am running the following query to copy the data from the CSV file:
COPY console_games FROM '/users/user1/Desktop/ConsoleGames.csv' DELIMITER ',' CSV HEADER;
And I get this result:
********** Error **********
ERROR: could not open file "/Users/user1/Desktop/ConsoleGames.csv" for reading: Permission denied
SQL state: 42501
I have changed the permissions of this file for all users to be read and write, but I still get the error.
I faced the same problem and here is how I solved
On Mac-
Open 'System Preferences'
Select 'Security and Privacy' option
Select 'Full Disk Access' from the list
Give access to PgAdmin AND postgres
Then, close and reopen your pgadmin
Use PgAdmin4's bulk-load features to import the CSV. This will do a COPY ... FROM STDIN behind the scenes. PgAdmin4 will access the file with your user's permissions, not those of the postgres server like a direct COPY from file will.
I solved this problem by creating a folder named Database in the PostgreSQL bin where I save all the data files that I want to work on. I use pgAdmin4 on both Mac and Windows. Whereas it is rather straightforward to find the bin on Windows, it is a bit tricky to find it on Mac because the Library where the bin is kept is hidden. Try to save your files on C:\ProgramFiles\PostgreSQL\10\bin\Database if you are using Windows and /Library/PostgreSQL/10/bin/Database/if you are using Mac. The Library can be found by pressing command+shift+g and type ~/Library on the go to folder. Your Mac will require your password to make changes in the Library. After saving your data files here, your code on pgAdmin4 should be like this:
COPY console_games FROM 'C:\ProgramFiles\PostgreSQL\10\bin\Database\ConsoleGames.csv' DELIMITER ',' CSV HEADER;
or
COPY console_games FROM '/Library/PostgreSQL/10/bin/Database/ConsoleGames.csv' DELIMITER ',' CSV HEADER;
On a Mac
Close PGAdmin
Open 'System Preferences'
Select 'Security and Privacy' option
Select 'Privacy'
Select 'Files and folders' from the list
Grant PgAdmin access for Documents-folder
Reopen PGAdmin

Viewing Realm database and defining adb as environment variable on macOS

I am new to using Android Studio, also new to using mac os and new to using realm.
My problem is I need to view my realm DB using the realm monitor for mac os, to do that I need to extract the DB file from my emulator using the terminal inside android studio, but I can't because I need to configure the system variables, I tried to do that using the mac os terminal but it didn't work, I searched and tried many tips online but got nothing.
If anyone can give me a detailed step by step guide to do this it will be very appreciated.
edit:
I need to view the realm DB file from my android application, I tried the solution in this link
How to view my Realm file in the Realm Browser?
so I need to extract the realm file from the emulator using the adb command, I tried that using the android studio terminal but could not recognize the adb command, after some research I found this links
Not able to access adb in OS X through Terminal, "command not found"
and
Setting ANDROID_HOME enviromental variable on Mac OS X
So I need to define ANDROID_HOME environment variable and path using mac terminal. I tried that - I opened mac terminal and wrote the following command directly:
export ANDROID_HOME=/Users/apple/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Then I opened the android studio terminal and tried to use adb command but still not found, then reopened mac terminal and wrote the following command: echo $ANDROID_HOME to check the value but I got nothing.
It seems I am missing something here I don't know what it is.
The path of my android sdk file is: /Users/apple/Library/Android/sdk
First Things First
You want to view your database information using Realm Browser.
In order to do so, you will need to extract the .realm file (the file that stores your realm database) from your android phone or emulator.
It seems like you need to define adb in your macOS environmental variables so you will be able to execute the suitable command to extract the file, as mentioned above.
Including adb as an Environmental Variable on macOS
In order to include adb command as an environmental variable you will need to do the following:
First, you need to open Terminal and type open ~/.bash_profile and then press enter.
You will be prompted with the TextEdit app with the .bash_profile file.
You need to add adb to the PATH in that file.
Copy the following to the file and save it (cmd + S):
#set adb:
ADB=/Users/YOUR_USERNAME/Library/Android/sdk/platform-tools
export ADB
#set PATH:
PATH=$PATH:$ADB
export PATH
Close the file, log out from your user (Apple menu => Log out) and then log in again.
In order to check that your PATH now contains the adb command, you can open Terminal and type echo $PATH. Now you should see your adb path as well.
You can also enter an adb command to see if you can run one (such as adb devices).
Extracting the realm File From Your Android Phone/Emulator
Realm Browser doesn't support accessing the existing databases on your device directly from the device itself.
There are three options to view a database on Realm Browser:
Open Realm File
Open Realm URL
Connect to Object Server
If you wish to view an existing database on your device, only the first option is relevant to you in that case. You will need to copy the database from the phone/emulator to your computer so you can view it.
In order to extract the database file from the device, please follow this:
Open Terminal, then navigate to a folder in which you would like to
save the database file. Navigate to that folder using the cd command.
For example, if you wish to save it to a folder "realmDB" on your desktop you need to type cd /Users/YOUR_USERNAME/Desktop/realmDB/.
Then type adb pull /data/data/APPLICATION_ID/files/ .
(where your applicationID can be found inside the build.gradle file under the defaultConfig block)
This will pull all realm files to that folder, where the database file is usually saved under the name default.realm. Now you can open that file using Realm Browser and see your database.
Note that the adb pull will only work on an emulator or on a rooted device.
Another possible solution suggested on one of the links you mentioned on your question is to use Stetho with realm plugin for Stetho in order to view your realm database.
That answer suggested installing and defining Stetho and then viewing the database file through chrome://inspect page under Resources => Web Sql => default.realm instead of viewing it using Realm Browser.
You can try that one too if you don't want to pull your database file for every change you make.

Wireshark - you don't have permission to capture on that device mac

I installed Wireshark and during the installation it showed an error but the installation itself completed. When I ran the program and tried to capture packets on my network, it showed this error:
I'm new to mac so i don't even know how to properly ask.
Could someone help me?
According to User: gmale's answer on ask.wireshark.org, he solved his problem in this way and I'm sure that it could solve yours as well. It says:
1- Open Terminal
To see your exact user name (for me that was AliGht)
2- Type 'whoami'
3- execute the following commands:
cd /dev
sudo chown AliGht:admin bp*
and enter your computer password:
4- now type this command:
ls -la | grep bp
The last command will display a list of files such as:
5- Make sure all of them have your user name and admin as the user/group. For some reason, the last one didn't get assigned properly so I had to run the command:
sudo chown AliGht:admin bpf4
so the last command fixed my problem as you see in the last image:
Done!
If your WireShark is open then close it and open it again.
All credits of this tutorial goes to user gmale on ask.wireshark.org,
If you want to open WireShark always as administrator then take a look to another post which I created a shortcut for it via Applescript, and this is the only way which you can open the WireShark always as administrator even when you turn off/on your mac.
I don't know how to solve this problem, but if you want a temporary fix, you can use the following command:
$ sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark
Wireshark provides the solution itself, along with the explanation of weird secrets:
add your user to the group "access_bpf" by commanding
sudo dseditgroup -o edit -a `whoami` -t user access_bpf
then launch Wireshark's script
sudo "/Library/Application Support/Wireshark/ChmodBPF/ChmodBPF";
That's all, because (as the script explains):
# Unfortunately, macOS's devfs is based on the old FreeBSD
# one, not the current one, so there's no way to configure it
# to create BPF devices with particular owners or groups. BPF
# devices on macOS are also non-cloning, that is they can
# be created on demand at any time. This startup item will
# pre-create a number of BPF devices, then make them owned by
# the access_bpf group, with permissions rw-rw----, so that
# anybody in the access_bpf group can use programs that capture
# or send raw packets.
If you want to open WireShark always as administrator I suggest to use AppleScript:
Open AppleScript: By pressing cmd+space and write AppleScript Editor in the Spotlight Search as picture below:
Then from File --> Choose NEW
In the open window write:
do shell script "/Applications/Wireshark.app/Contents/MacOS/Wireshark" ¬
with administrator privileges user name "username" password "password"
Change the "username" and "password" with yours. If you don't know your username in terminal write "whoami" to see your username, password is your computer password!.
Mine is look like this:
Now export your script as Application, by going to --> File --> Export , and change File Format to Application write a name for your file and Save it on your desktop like following pictures:
DONE now run your App from Desktop, and by this way your WireShark runs always by Admin Permission.
I have faced the same problem in MacOS High Sierra (v10.13.6). I have clean-up all dependency files and folders but nothing works for me.
Using the terminal, if I run the following command then it is working -
sudo chmod o+r /dev/bpf*
sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark
This should work.
Run the application from the terminal with the following command:
User$ **sudo Wireshark**
Wireshark should open and packet capture should work then.
Was having same issue with install and run permissions etc. Attempted a few of the above mentioned fixes and although they would come back with the desired result program still would not run properly even with uninstall/install in addition.Getting a bit overwhelmed with it not working after several remedies being attempted I came to one that was super simple and worked -
I simply set up/checked log in as root user. Here you can enable/disable root user account, enable log in account and change root password. So I just switched profiles from my Admin account to the Root account. (I am honestly not sure if its safe to do it this way, so thinking many of you have far more knowledge on this than me I'd appreciate your comments on that!) Also my understanding is that you cannot properly run sudo commands if root account is enabled - So probably just tuning it off if it were on would suffice, but I wanted a quick and easy install at that point. The steps are really easy:
support.apple.com/en-us/HT204012
Then just switch user accounts to root -Log in with "other" then type root and your password.
Now just install Wireshark and it should install and run properly!
**I don't think I would stay in root account after install.
Hope maybe this will help some!
I got same issue and then notice below document provide solution already.
https://www.wireshark.org/docs/wsug_html_chunked/ChBuildInstallOSXInstall.html
2.5. Installing Wireshark under macOS
The official macOS packages are distributed as disk images (.dmg) containing the application bundle. To install Wireshark simply open the disk image and drag Wireshark to your /Applications folder.
In order to capture packets, you must install the “ChmodBPF” launch daemon. You can do so by opening the Install ChmodBPF.pkg file in the Wireshark .dmg or from Wireshark iself by opening Wireshark → About Wireshark selecting the “Folders” tab, and double-clicking “macOS Extras”.
The installer package includes Wireshark along with ChmodBPF and system path packages. See the included Read me first.html file for more details.
I do not want to modify my folder permissions on my system device files like the accepted answer, but I was able to get permissions by opening Wireshark like this:
sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark
Bonus, you can add an alias to your ~/.zshrc:
alias ws="sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark"
Now execute the file: (or you can open a new terminal window)
source ~/.zshrc
Open wireshark with super user permissions:
ws

appcfg.py is not running with cmd prompt (Windows 7)

I am having strange problem. I used to run appcfg.py to update my app to appengine but now its not working anymore. When I run this command
C:\Program Files <x86>\Google\google_appengine>appcfg.py update E:\path\myApp\
Its not giving me anything, no error no feedback. Its just back to this line
C:\Program Files <x86>\Google\google_appengine>
Any idea about this issue!
P.S. I'm using Python 2.7. My code is updating through google app launcher but I need to run it from cmd prompt as I will be downloading/uploading appengine stuff which launcher doesn't allow me to do!
Thanks
I still had a little trouble with the instructions. Here's the steps I used to create a batch file to use the Google App Engine download_app with Windows 7.
In my example,
I'll use drive, C:
Default python path will be, C:\Python27\python.exe
GAE path (include "), "C:\Program Files (x86)\Google\google_appengine\appcfg.py"
App ID {your_app_id} will be just your app-id name
{your_app_version} is the "Version:" number in your GAE app.yaml file
I'll create a folder on my Windows 7 desktop and call it GAE_App
The desktop folder path will be C:\Users\{username}\Desktop\GAE_App
{your email} will be the Gmail account connected to your GAE
Right-click on the desktop and select New->Text Document. Open the newly created text document and add the following line of code modified for your setup to the blank text document,
C:\Python27\python.exe "C:\Program Files (x86)\Google\google_appengine\appcfg.py" download_app -A {your_app_id} -V {your_app_version} --email={your email} C:\Users\{username}\Desktop\GAE_App
Save the text document and change the file name to GAE_Download.bat
It's important that the extension now says ".bat" instead of ".txt"
Once finished, click on the batch to execute it. You'll be asked for a password and then the files should download into the GAE_App folder on your desktop. Now, whenever you need to download your files, just click on the batch file.
Not sure why Google didn't simply include this feature with their GAE for Windows software.
I faced the same issue. Here is a simple solution.
Just do this following Steps:
Go to program file where google app engine is installed. Generally It is named as Google.
click on appcfg.py and select open with.. Select "Choose Default Programs".
Select Python from programs and select "Always Use the selected program to open this kind of file" .
Now run the command you should get the results on command line.
For reference click here
Fixed by accessing python lib like that
C:\Python27>python appcfg.py update E:\path\myApp\
Here's a solution that worked for me:
"google_appengine/appcfg.py" update "C:\PATH TO APP
The appcfg.bat that should be used is located **C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\appengine-java-sdk\bin** and not the empty appcfg.bat that for some unknown reason also was here C:\Program Files\Google\Cloud SDK\
Good practice is to add this path to the system variable PATH
This worked for me
Basis
<PATH_TO_PYTHON>python <PATH_TO_APPCFG.PY>appcfg.py -A <PROJECT_INSTANCE_NAME> update app.yaml
Example
X:\Software\Python2.7\python Q:\SOFTWARE\GoogleAppEngineSDK\appcfg.py -A great-1337 update app.yaml

Resources