Easy and Secure File transfer from PC to Android via Wifi
I own a HTC Evo 4G and a Samsung Galaxy Tablet; and constantly find in need of copying documents, media files to these android devices.
I have found 2 ways of achieving this
- ES File Explorer – a featured File/Application Manager
http://www.estrongs.com/en/products/file-explorer.html
Allows to connect to a shared folder on the PC and Copy-Paste to local storage.
Pros: Free App
Cons: More clicks involved.
- QuickSSHd – Secure Shell/SSH Demon
http://www.androidzoom.com/android_applications/tools/quicksshd_gjvk.html
Can use winscp to connect and transfer files easily and in a secured manner.
Pros: Drag and Drop Files
Cons: Costs $1.5
QuickSSHD_WinScp
Importance of SetLocale in VB Script
I recently ran into an issue where a user complained that their network drives were not mapped when they login
after troubleshooting ; found the root cause was the login scrips fails to write koran time/date char’s to the log file and exit’s.
If the locale is not explicitly set to en-us (1033) it uses the locale from the user session and hence the problem.
Prevent issues like these from surfacing by initializing locale in your script.
Dim english_lcid english_lcid =1033 SetLocale(english_lcid)
Happy Coding...
Powershell and Bash
Create a empty file
Bash
touch <filename>
Powershell
New-Item <filename> -type file
Powershell Dir recursive with Depth
####################################################
#### Siva Mulpuru ########
#### <scipt_file.ps1> input.txt ########
#### input.txt – list of fileshares/dir ########
####################################################
cls
New-Item -ItemType directory “c:\tmp” 2>> $null
$folder_depth = 6
#Dynamic LogFile name
$log = “c:\tmp\$(get-date -Format yyymmdd-HHmmss).log”
#File Extensions to look for
$virus_extensions = @(“*.scr,*.exe”)
function DOWork([string]$path)
{
if ($path -ne $null){
Write-Output “$((get-date).ToString()) Inside $($path)” >> $log
$virus_files = (dir $path -force -include *.scr)
foreach($virus_file in $virus_files)
{
if($virus_file -ne $NULL){
Write-Output “Virus File ” $virus_file.FULLNAME
#Extra Condition – FileSize < 70Kb
if($virus_file.Length -lt 70000)
{
Write-Output “$((get-date).ToString()) Red Alert: $($virus_file.FULLNAME) ” >> $log
}
}
}
}
}
if($args.count -eq 0)
{
Write-Output “Need the FileShare Input file”
exit
}
elseif(Test-Path $args[0]){
$input_file_contents = Get-Content $args[0]
foreach($line in $input_file_contents)
{
if(($line -ne $NULL) -and (Test-Path $line))
{
$enum_root_dir = (dir $line | where { $_.mode -like “*d*”})
foreach ($subdir in $enum_root_dir)
{
$curr_dir=$subdir
#Folder Depth Condition
for($i=1;$i -le $folder_depth;$i++)
{
foreach ($subdir2 in $curr_dir)
{
if(($subdir2 -ne $NULL) -and (Test-Path $subdir2.FULLNAME)){
DoWork($subdir2.FULLNAME+”\*”)
$curr_dir= (dir $subdir2.FULLNAME -force | where { $_.mode -like “*d*”})
}
else
{break}
}
}
}
}
}
}
else
{
Write-Output “$args[0] does not exit”
}
Powershell Profiles
PowerShell uses profiles to help customize the shell environment. There are a few files which customize the profile:
- %windir%\system32\WindowsPowerShell\v1.0\profile.ps1 This profile is loaded for all users.
- %windir%\system32\WindowsPowerShell\v1.0\ Microsoft.PowerShell_profile.ps1 This profile is loaded for all users, and only for the default instance of PowerShell.
- %UserProfile%\My Documents\WindowsPowerShell\profile.ps1 This profile is loaded per-user, and affects all versions of PowerShell which are installed.
- %UserProfile%\\My Documents\WindowsPowerShell\ Microsoft.PowerShell_profile.ps1 This profile is loaded per-user, but only affects the default instance of PowerShell.
Get Powershell CMD-Lets from a 3rd Party Snapin
add the -pssnapin parameter to the Get-Command cmdlet to see which cmdlets are in a particular snap-in. Below is a partial list for the Microsoft.PowerShell.Core snap-in:
get-command -pssnapin microsoft.powershell.core
Powershell get version
get-host | select version
Powershell Admin Scripts
To get the process owner.
(Get-WmiObject win32_process | where{$_.Name -eq ‘explorer.exe’}).getowner() | Select domain, user
To find the systems that are alive
$result = Get-WmiObject -query “select * from win32_pingstatus where address=’google.com’ ”
if ($result.StatusCode -eq 0)
{echo “google.com is alive”}
else
{echo “google.com is not pingable”}
Vista/Win 7 Backdoor
- Boot with any live cd (Ubuntu/WinPE etc) to get access to windows file system
- rename c:\windows\system32\magnify.exe to magnify.exe.bak
- make a copy of c:\windows\system32\cmd.exe and rename that to magnify.exe
- reboot the machine, boot normally to windows by removing the live cd.
- once you see the “press ctrl alt del to login”, press “winkey + U”, this will bring up the Ease if Access window.
- Choose magnifyand hit ok, this will lauch that cmd.exe we placed before. this cmd.exe has full access to the system, you can call any program from here like compmgmt.msc and actually reset the admin password or create a new admin account.
Note: the following are the list of usefull mmc files
Certificates | certmgr.msc |
Indexing Service | ciadv.msc |
Computer Management | compmgmt.msc |
Device Manager | devmgmt.msc |
Disk Defragmenter | dfrg.msc |
Disk Management | diskmgmt.msc |
Event Viewer | eventvwr.msc |
Shared Folders | fsmgmt.msc |
Group Policy | gpedit.msc |
Local Users and Groups | lusrmgr.msc |
Removable Storage | ntmsmgr.msc |
Removable Storage Operator Requests | ntmsoprq.msc |
Performance | perfmon.msc |
Resultant Set of Policy | rsop.msc |
Local Security Settings | secpol.msc |
Services | services.msc |
Windows Management Infrastructure (WMI) | wmimgmt.msc |
Component Services | comexp.msc |