My main goal is to to get VIN no of my control unit but for that i need to send command to controller and before sending any command to controller i must have to claim address.
I have send below command on my network but didn't got any response from it.
Msg.id.pdu_bit.edp = 0;
Msg.id.pdu_bit.dp = 0;
Msg.id.pdu_bit.pf = 234;
Msg.id.pdu_bit.ps = 255;
Msg.id.pdu_bit.sa = 249;
Msg.id.pdu_bit.pri = 6;
Msg.buf[0] = 0x00; //LSB First
Msg.buf[1] = 0xEE; // pgn for claim address
Msg.buf[2] = 0x00;
Msg.len = 3;
Is this is right way to claim address or do i have send different command??
It looks like you have some confusion between PGN 60928 (address claim) and PGN 59904 (request PGN)
Msg.id.pdu_bit.pf = 234;
Needs to be
Msg.id.pdu_bit.pf = 238;
The PGN for address claim is 60928 so your PF field in your J1939 header needs to be 238 (0xEE). Your data is going to be application specific although it's data length should be 8. See J1939 Spec slide 41 for more information on this data format.
Alternatively if you use PGN 59904, THAT is when your data length is 3 (unless you have more application specific information) and your data is the PGN that you want to request.
You do not have to request an address claim PGN, you just simply send out the address claim with your source address set to the address you want to claim.
Related
I set up an OpenBSD 7.0 instance on Vultr in order to get a mail server running with Dovecot and OpenSMTPD. I (mostly) followed the instructions here and here and a bit here.
I set it up to use with virtual mail, creating files in '/etc/mail/virtual' and '/etc/mail/credentials' with a single virtual user: 'user#domain.ca::vmail:2000:2000:/var/vmail/domain.ca/user::userdb_mail=maildir:/var/vmail/domain.ca/user'
I created the encrypted password with 'smtpctl encrypt' and pasted it where it should be in the credentials file.
However, running 'doveadm auth login user#domain.ca' fails.
In /var/log/maillog I get:
Jan 25 14:06:58 vultrBSD dovecot: auth-worker(165): conn unix:auth-worker (pid=44111,uid=518): auth-worker<1>: bsdauth(user#domain.ca): unknown user
Jan 25 14:06:58 vultrBSD dovecot: auth: passwd-file(user#domain.ca): Password mismatch
I know the password is correct, and I tried changing it and pasting in a new one that I created with 'smtpctl encrypt', but still the same error. The '/etc/mail/credentials' file is set to 0440 and owned by _smtpd:_dovecot. Even temporarily setting it to 0777 doesn't work.
I can send mail to the server from another account, I see that is shows up in '/var/vmail/domain.ca/user/new' but I am unable to connect my Thunderbird client to the server. Attempting to set up a new mail account in Thunderbird doesn't seem to work, Thunderbird rejects the password (although it does detect the correct protocols and ports, IMAP/SMTP).
Here is the local.conf file in /etc/dovecot:
auth_debug_passwords = yes
auth_mechanisms = plain
first_valid_uid = 2000
first_valid_gid = 2000
mail_location = maildir:/var/vmail/%d/%n
mail_plugin_dir = /usr/local/lib/dovecot
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext imapsieve vnd.dovecot.imapsieve
mbox_write_locks = fcntl
mmap_disable = yes
namespace inbox {
inbox = yes
location =
mailbox Archive {
auto = subscribe
special_use = \Archive
}
mailbox Drafts {
auto = subscribe
special_use = \Drafts
}
mailbox Junk {
auto = subscribe
special_use = \Junk
}
mailbox Sent {
auto = subscribe
special_use = \Sent
}
mailbox Trash {
auto = subscribe
special_use = \Trash
}
prefix =
}
plugin {
imapsieve_mailbox1_before = file:/usr/local/lib/dovecot/sieve/report-spam.sieve
imapsieve_mailbox1_causes = COPY
imapsieve_mailbox1_name = Junk
imapsieve_mailbox2_before = file:/usr/local/lib/dovecot/sieve/report-ham.sieve
imapsieve_mailbox2_causes = COPY
imapsieve_mailbox2_from = Junk
imapsieve_mailbox2_name = *
sieve = file:~/sieve;active=~/.dovecot.sieve
sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment
sieve_pipe_bin_dir = /usr/local/lib/dovecot/sieve
sieve_plugins = sieve_imapsieve sieve_extprograms
}
protocols = imap sieve
service imap-login {
inet_listener imaps {
port = 993
}
}
service managesieve-login {
inet_listener sieve {
port = 4190
}
inet_listener sieve_deprecated {
port = 2000
}
}
ssl_cert = </etc/ssl/domain.ca.fullchain.pem
ssl_key = </etc/ssl/private/domain.ca.key
userdb {
args = username_format=%u /etc/mail/credentials
driver = passwd-file
name =
}
passdb {
args = scheme=CRYPT username_format=%u /etc/mail/credentials
driver = passwd-file
name =
}
protocol imap {
mail_plugins = " imap_sieve"
}
Has anyone else experienced this and know of a fix?
Thanks.
Hashed strings, including passwords, typically use several layers besides the base hashing algorithm. Two different implementations (dovecot vs smtpd) using the same hashing algorithm will output two different hashes given the same input (password.)
This is due to what is called salt and pepper. Salt is a randomly generated string usually based on some user data as the seed. This salt is then inserted into the password in a way dictated by the implementation (dovecot or smtpd) before hashing the password.
Similarly, pepper is a string dictated by the implementation and inserted into the password before hashing. This combination of salting and peppering creates a unique hash per implementation which makes storing passwords safer. This makes it so that a cracker can't easily compare hashes from several sites or programs to crack user passwords and break into all instances of that password simultaneously.
This is why you can't reuse a password hash stored by one program to unlock the same password when used by another program. Even if both programs use identical hashing algorithms.
The fix should be to set up the credentials individually for each program and not reuse each other's hashes.
In an application developed with Borland C++Builder 6, I am using TIdSMTP and TIdMessage to send email messages. Due to problems for external applications with the usual mail server in the configuration, I am defining the connection data through my Gmail account as follows:
Correo->From->Address = "******#******.org";
Correo->ReplyTo->EMailAddresses = "******#******.org";
Correo->From->Name = "*******";
Correo->Organization = "*******";
Enviar->Host = "smtp.gmail.com";
Enviar->Password = "******";
Enviar->Port = 465;
Enviar->Username = "******#gmail.com";
Enviar->UseTLS = utUseImplicitTLS;
SSLIOHandler->Port = 465;
SSLIOHandler->Host = "smtp.gmail.com";
SSLIOHandler->Destination = "smtp.gmail.com:" + IntToStr(SSLIOHandler->Port);
SSLIOHandler->SSLOptions->Method = sslvTLSv1_2;
SSLIOHandler->SSLOptions->Mode = sslmUnassigned;
The emails are sent without any problem, but I am checking that in addition to the copies that I send one to my Gmail address. I have verified that the Gmail address appears in the message headers in the Return-Path field.
I have been looking and, at least in Indy 10 for BCB 6, I have not found how to modify that field. How can I get copies to only reach the address indicated in the ReplyTo field of TIdMessage?
The TIdMessage.ReplyTo property has no effect on the Return-Path header. The ReplyTo is only used for the Reply-To header, which recipients use to reply back to the sender. The Reply-To header is not used by the receiving SMTP server at all.
The Return-Path header is generated by the receiving SMTP server using the address specified in the sending client's SMTP MAIL FROM command. You can specify that address in the TIdMessage.Sender and TIdMessage.From properties (in that order), or by using one of the other overloaded TIdSMTP.Send() methods that has an AFrom parameter.
I have stored data on sawtooth in protobuf format at an address (address made from public key and transaction family).
Get request was made on
http://rest-api:8008/state/
to get data in the format
{
"data": "CkIwM2FjNjA3MTUzZmRlMzJhNzhiNDFlMzkxN2QwZDlkZmJmMmM2NjZmOWFhZGMzMWRiNTNjODZhNzFkNDMyNmZkNGUSBnNlbGxlchoROTc4LTAtNTc2LTUyMzk1LTAiETgxOS02OTAtNzk4Nng1MTE5Kg0xLTk4MTAtMTE0NS01",
"head": "bea2911b4d84b897300fc4a9eb6b56b7ddc59c88c115dab6c09935d658b57cf229b538a3cb3d407647211c8847e46db07f9cff65af2835dfc7732be9b443fae3",
"link": "http://192.168.1.13:8008/state/318c9fa678220444fb9b209a57c849320a7f61c984e5b8a6a56880030728bdb530a5d0?head=bea2911b4d84b7c7300fc4a9eb6b56b7ddc59c88c115dab6c09935d658b57cf229b538a3cb3d407647211c8847e46db07f9cff65af2835dfc7732be9b443fae3"
}
I posted Account data on the sawtooth-rest-api, if the details are correct(checked by processor), Account with additional "Public Key" is inserted onto the blockchain. This is the account protobuf class, which was serialized before it was inserted onto the blockchain.
message Account {
string public_key = 1;
string user_type = 2;
string adhaar_number = 3;
string phone_number = 4;
string pan_card_number = 5;
}
transaction = Account()
transaction.ParseFromString( base64.b64decode(data.encode()))
THat just gave a number 129.
Update:
The account data serialization output is
b'\nB033c10fa02a3b602f008e7837a48d4492f5105417111404c4404b49f51222d30c1\x12$60405711-dd32-47c1-a914-3e19ee5177b1\x1a\x06seller"
\x11978-1-61207-456-6*\x10+64(0)19727879362\r0-609-80129-5'
when I base64 encoded it, it gives exactly the same string which i got from sawtooth api under the data key.
but somehow transaction.ParseFromString gives just an integer of 3 digits, Couldnt get the account back.
Sorry I figured this out:
After
account=transaction.ParseFromString(<serializedBytes>)
The account details can be accessed like normal class variables.
account.public_key
account.adhaar_number
If my understanding is correct, you retrieve data vis-a-vis the REST API /state/xxxx or /state?address=xxxx.
When data is put on the chain in a TransactionProcessor via setState or similar call, it does a base64 encoding first.
You will need to do a base64 decode and then ParseFromString on that result.
I'm sending members of my site emails after an event so they can rate and tip their teachers. Is there a way to create some unique key and include this in the email link back to my site so they can rate and tip without having to login back in? If so what's the best way to do this? Is there something in Asp.Net identity?
It looks like Uber might be doing this with their tip link below but I'm not sure.
https://gratitude.uber.com/tips/trip/33879346-bba8-406a-82a8-2afcda9aa3e7
Add the users to a database and then send the link with their UserId as a query string:
www.mysite.co.uk/survey?id=4546
Create a controller called surveycontroller with a parameter to capture the id and direct to the survey html page.
Check this article
The .net Framwork provides RNGCryptoServiceProvider class which
Implements a cryptographic Random Number Generator (RNG) using the
implementation provided by the cryptographic service provider (CSP).
This class is usually used to generate random numbers. Although I can
use this class to generate unique number in some sense but it is also
not collision less. Moreover while generating key we can make key more
complicated by making it as alpha numeric rather than numeric only.
So, I used this class along with some character masking to generate
unique key of fixed length. Below is code sample:
private string GetUniqueKey() { int maxSize = 8 ; int minSize = 5 ; char[] chars = new char[62]; string a; a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; chars = a.ToCharArray(); int size = maxSize ; byte[] data = new byte[1]; RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider(); crypto.GetNonZeroBytes(data) ; size = maxSize ; data = new byte[size]; crypto.GetNonZeroBytes(data); StringBuilder result = new StringBuilder(size) ; foreach(byte b in data ) { result.Append(chars[__b % (chars.Length - )>); } <span class="code-keyword">return result.ToString(); }
As you mentioned in comments there might be security issues, you can use blow method to avoid them:
check for user last ip address loged in with to know this is actually the user opening the link
check for user cookies
create block list for subspecies bruteForce attack
make the generated key disabled and enable it after all above security passed
use captcha verification to avoid BruteForce or non human access your page
I am working on an ASP.NEt mvc web application, that stores data regarding network devices.but I need to know if there is a global format for these numbers:-
IP address
MAC address
VLanID
subnetmask
And is there any data annotations I can use to implement data validation for these numbers?
Thanks
For IP Address:
IPAddress ip = new IPAddress((long)ips);
return ip.ToString();
To store IP address, read this
For MacAddress, i dont know any existing formats. but you can take it from string.
string macAddStr = "00E0EE00EE00";
string macAddStrNew = macAddStr;
int insertedCount = 0;
for(int i = 2; i < macAddStr.Length; i=i+2)
macAddStrNew = macAddStrNew.Insert(i+insertedCount++, ":");